Re: Vbase offsets
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Vbase offsets
- To: dehnert@xxxxxxx, Mark Mitchell <mark@xxxxxxxxxxxxxxxx>
- Subject: Re: Vbase offsets
- From: dehnert@xxxxxxxxxxxxxxxxxxxx (Jim Dehnert)
- Date: Tue, 4 Apr 2000 17:46:07 -0700 (PDT)
> From: Mark Mitchell <mark@xxxxxxxxxxxxxxxx>
>
> 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@xxxxxxx
(650)933-4272