Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2005-10-28 15:21:22


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.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk