This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: sizeof with virtual inheritance


Eljay Love-Jensen writes:

> No, my comments were specifically about virtual inheritance.

Well, here's what you wrote:

> For example, if you have multiple inheritance of:
> foo : bar
> baz : bar
> quux : foo, baz

You probably implied it, but you didn't mention virtual inheritance, so I
thought you didn't talk about it. Nevermind :)

> Look at the memory layout of c4, which is 8 bytes:
> c4 : byte[0 ... 3]
> c4.c1 : byte[4]
> c4.pad : byte[5 ... 7]
> 
> Those [0 ... 3] four bytes for the c4 portion (alone) of c4 contains the 
> pointer for the multiple inheritance overhead.

How can I see the layout like that?
And what is the actual use of that "pointer for the multiple inheritance
overhead"? What does it point to and when and how is it used?

[removed comment about "c6.c2.c3.c1" because you replied about it]

> The padding is alignment padding.

Is it possible to disable it, especially that it's at the end of the layout?

Thanks
Adrian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]