Virtual base class offsets in vtables

Mark Mitchell mark at codesourcery.com
Sun Jan 16 22:21:24 UTC 2000


Folks --

  o Why do we have two different ways of computing the order in
    which vbase offsets are laid out in the vtable?  (Category 3
    says left to right in declaration order; Category 4 says 
    in left-to-right depth-first order.)

  o Furthermore, it's unclear whether or not offsets for indirect
    virtual bases should be stored.  The Category 3 description
    seems to indicate that only *direct* bases should be stored;
    otherwise left-to-right declaration order isn't really
    well-defined.  But, Category 4 clearly says direct or indirect 
    bases.

  o The term `visible' used in the Category 4 specification is
    undefined.  This is a bad choice of terminolgy; visibility is
    used in the C++ standard to contrast with `hidden'.  Here, I
    think visible is meant to denote classes in the inheritance
    hierarchy dominated by the base.

  I suggest that we clarify this as follows:

  o Use a term other than `visible' and define it.
  o Remove the current descriptions of vbase offset ordering, and 
    replace them with:

  In the primary vtable, the vbase offsets are in the reverse order in
  which the virtual bases are encountered in a depth-first,
  left-to-right traversal of the inheritance graph.  In the secondary
  vtables for a given base B, offsets are only included for those
  virtual bases present in the primary vtable for B, and are present
  in the same order.

--
Mark Mitchell                   mark at codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com




More information about the cxx-abi-dev mailing list