Quote Originally Posted by Ushakal View Post
You should also arrange data types so that they slot together nicely:
The "slot" theory often doesn't work, as Elysia noted, because shorts are often aligned to a larger byte interval.

A common rule of thumb is to declare the members in order of decreasing size (i.e. big ones first). That doesn't guarantee no padding but is often a reasonable step towards minimising the total amount of padding added.

Since alignment of variables on (processor dependent) word boundaries often has a performance benefit most compilers add padding by default. For this reason, the sizes you quoted in your example are not guaranteed.