|
|
Warp wrote:
> Darren New <dne### [at] sanrrcom> wrote:
>> Consider the case of "class alpha
>> {int abc;}" for a counter-example - I know exactly how that's laid out due
>> to the standard.
>
> I don't think the standard specifies what kind of padding the compiler
> will use between member elements.
It specifies that the first element has no padding before it.
> For example, if you have a "struct { char c; int i; };", how many bytes,
> if at all, are there between 'c' and 'i'?
That's a different example, yes. It's going to be compiler/architecture
dependent.
> Oh, and it becomes even more complicated:
>
> class A { int i1; public: virtual ~A(); };
> class B1: virtual public A { int i2; };
> class B2: virtual public A { int i3; };
> class C: public B1, public B2 { int i4; };
>
> Want to start guessing the offsets of the ints inside C? Good luck.
I don't think the standard says what the offsets are for classes with
virtual destructors.
--
Darren New, San Diego CA, USA (PST)
My fortune cookie said, "You will soon be
unable to read this, even at arm's length."
Post a reply to this message
|
|