Vcall/vbase offset clarification
Jason Merrill
jason at cygnus.com
Thu Feb 10 20:35:42 UTC 2000
>>>>> Jim Dehnert <dehnert at baalbek.engr.sgi.com> writes:
>> From: Martin von Loewis <loewis at informatik.hu-berlin.de>
>> To: mark at codesourcery.com
>>
>> > > 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?
> I think the right statement is 'we know statically how to adjust "b" to
> get an "A*". If A is a non-virtual base, we know the offset
> statically. If it is a virtual base, we know statically where to fetch
> the vbase offset in the vtable.'
No, I'm with Martin on this. We're trying to adjust from A* to C*; the
adjustment from B* to A* is not useful.
Jason
More information about the cxx-abi-dev
mailing list