Look at these 2 structs
struct parent_t
{
short num1;
char chrA;
char chrB;
char chr1;
};
struct child_t
{
struct parent_t parent;
char chr2;
};
As we know, padding maybe added to struct members in order to increase it to a comfortable RAM-friendly size. In parent_t
's case, chr1
will likely be padded because of its minusculity. Whilst chrA
and chrB
will likely be combined and share the same word in ram.
Now if we look at child_t
, it has chr2
, which by itself would be padded. My question is will chr1
and chr2
be optomise such as chrA
and chrB
? If so, what is that called?
For this instance I am assuming that a 1 word = 1 short = 2 chars.