Construction vtables example.

Coleen Phillimore coleen at zko.dec.com
Mon Apr 17 19:45:57 UTC 2000


For the Construction Vtables section, I have two corrections and comments
on the red parts.

The red part in "VTT Order" #3  - it should be depth first search postorder.
I don't understand the parenthetical remark with respect to "relevant
condition", since you have a secondary vptr if either condition holds (
virtual bases or virtual function overrides).  There's a black 'preorder'
in that paragraph too that should be postorder.

#4 red part looks okay.

In the example, you have 11 entries in the VTT, I think it's because you
moved the virtual function in A2 from A1.  But now A2 shares the virtual
function table with V1 so there's no extra vptr (which I think is what
you were trying to show).  This is the VTT order that I get from finally
instrumenting my compiler to print it out.

primary vtable for class D index 1
  secondary VTT for base C1 index 2
  secondary VTT for base C2 index 3
  secondary VTT for base C2 sub_bcp V1 index 4
  secondary VTT for base C2 sub_bcp V2 index 5
  secondary vptr for base V1 index 6
  secondary vptr for base V2 index 7
  secondary vptr for base C2 index 8  ( postorder!! )
  secondary VTT for base V2 index 9
  secondary VTT for base V2 secondary vptr V1 index 10
                                          (who shares vptr with A2 now)

If you make A2 virtual then you get 14 entries in the VTT.  The
exercise is left to the astute reader.

Coleen
-- 
-----------------------------------------------------------------------
Coleen Phillimore                  | mailto:coleen at zko.dec.com
Compaq Computer Corp.   Nashua, NH | COMPAQ C++ Compiler Development
-----------------------------------------------------------------------




More information about the cxx-abi-dev mailing list