Vtable layout question

Steve Ellcey sje at cup.hp.com
Thu Jul 24 22:32:49 UTC 2003


I was wondering if someone who understands the C++ ABI better then I do
could answer a question for me.  Specifically in section 2.5.2 it says:

| Following the primary virtual table of a derived class are secondary
| virtual tables for each of its proper base classes, except any primary
| base(s) with which it shares its primary virtual table.  These are
| copies of the virtual tables for the respective base classes (copies in
| the sense that they have the same layout, though the fields may have
| different values).  We call the collection consisting of a primary
| virtual table along with all of its secondary virtual tables a virtual
| table group.  The order in which they occur is the same as the order in
| which the base class subobjects are considered for allocation in the
| derived object:

My question is why does the location and order of the secondary vtables
matter.  I *think* the only way to get to one of these secondary vtables
is through the VTT, in which case all that really matters is that the
pointers in the VTT point to the correct vtables and the actual ordering
and location of those vtables is immaterial.  Is that correct or am I
missing an important aspect of the ABI?

Steve Ellcey
sje at cup.hp.com



More information about the cxx-abi-dev mailing list