Huw Davies huw@codeweavers.com wrote:
There are 9 elements of 2 bytes in size each, 18 bytes in total, the compiler will align this structure to 4 bytes, making its size 20 bytes.
The size is irrelevant - it's variable sized anyway. We just care about the offsets of the elements.
Anyway, in order to avoid any confusion or bugs in future with allocating an array of such structures or using sizeof() on them I'd suggest to explicitely specify alignment.