vtable layout

thomson at ca.ibm.com thomson at ca.ibm.com
Fri Aug 27 04:33:04 UTC 1999




Jason Merrill:

>It seemed simpler to me just to add the slot to D's vtable; since we know
>the layout of the vtables, we can find it from any of the secondary vptrs.
>But adding it to a secondary vtable from one of D's direct bases would also
>work.

Well, the value you need to find depends on which secondary vptr you started
from; what needs to be common is the offset you add to each vptr to find its
associated adjustment.

But the more significant point to make, is that the inter-vtable navigation
you describe isn't possible with this design, since a B in D vtable may not
have the same number of adjustment slots that a B in D in DD has.  Only
if you know the most-derived type can you actually map the aggregated vtable.
You do know enough when you are referring to a vtable by name, but
not when you've been handed a "B in D in ?something?" vptr.


Brian Thomson
Visual Age C/C++ Chief Architect






More information about the cxx-abi-dev mailing list