
28 Oct
2005
28 Oct
'05
8:21 p.m.
Fernando Cacciola wrote:
struct Echar { E e ; char c; } ;
struct charE { char c; E e ; } ;
sizeof(Echar) -> 24 sizeof(charE) -> 32
As you can see, the true alignment of T is 4, while 12 is just 3 times that.
The "preferred" alignment of E seems to be 8 (makes sense because of the long long), which is why the sizes are a multiple of 8. Why is sizeof(E) 20, however, I don't know. Alignments are tricky.