Vcall/vbase offset clarification

Martin von Loewis loewis at informatik.hu-berlin.de
Fri Feb 4 10:09:13 UTC 2000


> > From mitchell at codesourcery.com  Tue Jan 25 13:26:12 2000
> >   struct A { void f();}
> >   struct B : public virtual A {};
[...]
> >   o First, we convert to the most derived class in which `f' was
> >     overridden.  That's `A'.  We know statically what offset
> >     to adjust `b' by to get an `A*'.

Maybe you didn't mean it that way, but: How do we know statically the
offset needed to adjust a B* to an A*? Wouldn't we have to look in the
vtable at run time to fetch the vbase offset?

> >   o We pass this value to the function found in the vtable for `A'.
> > 
> >   o That function will first perform the constant adjustment from 
> >     `A' to `B'.  

Or perhaps that shouldn't have been virtual inheritance in the B
bases?

Regards,
Martin




More information about the cxx-abi-dev mailing list