Indirect primary bases

Mark Mitchell mark at codesourcery.com
Tue Aug 1 03:40:18 UTC 2000


>>>>> "Jim" == Jim Dehnert <dehnert at baalbek.engr.sgi.com> writes:

    >> From: Mark Mitchell <mark at codesourcery.com>
    >> 
    >> Why do we ever pick an indirect primary base as a primary base?
    >> 
    >> That doesn't save space in the object since the primary base we
    >> choose was some other base's primary base.  Furthermore, we now
    >> have to replicate that bases vtable entries in all the places
    >> where it is a primary base.
    >> 
    >> What's the benefit?

    Jim> Well, first, its vtable is now at the same address as that of
    Jim> the derived class, and won't need a distinct vtable pointer
    Jim> load.  Also, calls to its virtual functions won't require
    Jim> 'this' adjustments.  If I'm mistaken about these, or if you
    Jim> don't think they're adequate benefits, we can open the issue.

No, I buy it.  Let's put a note in the ABI document, though.  I think
it's much easier for people to understand this stuff if there's some
rationale present.

Thanks,

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




More information about the cxx-abi-dev mailing list