Virtual base allocation (was: Typo ...)

Mark Mitchell mark at codesourcery.com
Tue Apr 4 00:22:59 UTC 2000


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

    Jim> I believe this is not correct.  We ultimately decided not to
    Jim> make separate allocation of primary bases dependent on
    Jim> whether they occurred earlier than their derived class in the
    Jim> hierarchy.  Is this what others recall?  (That's what the
    Jim> document says now.)

That's not what the layout said to me when I read it. :-)

I can see how it could mean either thing:

  Finally allocate any direct or indirect virtual base classes (except
  the primary base class or any indirect primary base classes) as we did
  non-virtual base classes in step II-2 (if empty) or II-3 (if
  non-empty), in inheritance graph order. Update sizeof(C) to max
  (sizeof(C), offset(D)+nvsize(D)). If non-empty, also update align(C)
  and dsize(C) as in II-2.

It's unclear how the looping is going here:

  for each virtual base
    if not already primary
      allocate

or:

  let vbs = not already primary virtual bases
  for each base in vbs
    allocate

English is just not a great language for describing algorithms. :-)

It seems to me that the first loop is not particularly harder to
implement and makes for somewhat smaller classes, so that's what I had
assumed we wanted -- but I don't recall what the decision was.  I'd
prefer alternative 1, but not if it means reopening the issue;
clarification works for me.

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




More information about the cxx-abi-dev mailing list