Boost logo

Boost :

From: Rozental, Gennadiy (gennadiy.rozental_at_[hidden])
Date: 2003-09-25 13:48:14


> "Rozental, Gennadiy" <gennadiy.rozental_at_[hidden]> wrote in
> message
> news:1373D6342FA1D4119A5100E029437F6405E1FA69_at_clifford.devo.ilx.com...
> > Probably not. Because of the alignment.
> >
> > struct A {
> > int a;
> > char b;
> > };
> >
> > sizeof(A) = 8
> >
> > Gennadiy
> >
>
> I'm using bcc32 option -a1 -Vx -Ve which means that
> 1. -a1 : aligment is 1

This basically says - disregard alignment

> 2. -Vx : Zero-length class data member
> 3. -Ve : Zero-length empty base classes
>
> And with this option set your example gives size 5,
> and sizeof(variant<int>) is still is 8.

This is probably because Eric is using int as a type for selector member. I
mentioned it to him during review that it should be char. On the other hand
I found that In majority of the cases (when you are not or could not ignore
alignment) size will be the same.
 
> regards,
> bohdan

Gennadiy.


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