On Fri, Jun 05, 2009 at 07:42:43AM -0700, Brian Budge wrote: > Actually, I was under the impression that the sizeof(my_type_t) should > be 24 to guarantee 8-byte alignment of the 8-byte types? In other > words, I would have expected 24 bytes instead of 20. Can anyone > explain why it's only 20? Indeed on my 64 bit machine it is 24 bytes, > but is that an artifact of being on x86-64? 32-bit GCC on x86 defines the alignment of long long to 4 bytes, while 64-bit GCC on x86 defines the alignment to be 8 bytes. Unfortunately the 32 bit x86 is also stuck with doubles being aligned on a 32-bit boundary, due to the fact that the people creating the original ABI were using a 386 which did not need higher alignments, and newer processors lose performance because it isn't properly aligned. The size must always be a multiple of the alignment, so on x86 -m32, the size is 20 bytes and on x86 -m64 it is 24 bytes. FWIW, on powerpc systems, the alignment of long long is always 8 bytes, so the structure would be 24 bytes in size. -- Michael Meissner, IBM 4 Technology Place Drive, MS 2203A, Westford, MA, 01886, USA meissner@xxxxxxxxxxxxxxxxxx