As a general rule of thumb, if you sort your structs into decreasing
size, it usually comes out right.  That is, put all your 64-bit items
first, then all your 32-bit items, then 16-bit, then 8-bit.  Then there
are no "holes" except the one at the end, which most compilers are
pretty good at keeping track of.

But yes, you could still certainly misalign the whole struct if it's
embedded in a stream of something with smaller alignment constraints.

Larry

Reply via email to