Vbase offsets
Jim Dehnert
dehnert at baalbek.engr.sgi.com
Wed Apr 5 00:46:07 UTC 2000
> From: Mark Mitchell <mark at codesourcery.com>
>
> OK. But, given:
>
> struct S {
> virtual void f();
> };
> struct T : virtual public S {};
> struct U : public T {};
>
> Are there two vbase offsets for `S' in the vtable for `U'? Here `T'
> is the primary base for `U', so the vtable for `U' already has an `S'
> entry. I assume we don't want to add an extra one. Maybe that
> example would be helpful, too? What if `T' is inherited virtually?
> Then, `T' is still the primary base of `U', so I don't think we need
> an extra offset here either? If I'm right, that's probably worth
> mentioning too. So, I think the rule is:
>
> If there is no primary base class, then there is a vbase offset for
> every direct or indirect virtual base. Otherwise, a vbase offset is
> present in the derived class for every virtual base that does not
> already have a vbase offset in the primary base class vtable. In
> either case, the vbase offsets are allocated in reverse inheritance
> graph order.
No, we shouldn't replicate vcall or vbase offsets from primary bases.
I've updated it, though not with exactly your language, and added
your example. Take a look.
Jim
- Jim Dehnert dehnert at sgi.com
(650)933-4272
More information about the cxx-abi-dev
mailing list