Empty class passing details
    Mark Mitchell 
    mark at codesourcery.com
       
    Mon Nov 13 20:06:17 UTC 2000
    
    
  
>>>>> "Mark" == Mark Mitchell <mark at codesourcery.com> writes:
    Mark> We should also say what to do with return values.  And, I
    Mark> think in the spirit of easy reading, we should say:
    Mark>   as thought it were a struct containing a single char,
    Mark> i.e., `struct S { char c; };'
Will wonders never cease...
David Gross points out that an empty class can have size greater than
one.  (Conflicts from base classes that can't go at the same
address...)
I bet I have made this assumption in code in a few places, and I bet
it's implied several places in the draft ABI, too.
There are two ways to fix this:
  - Change the definition of empty class to say a class that has 
    no data members, etc., and has size one.
  - Make a pass through everything fixing it up.
This case is sufficiently pathological (empty classes with multiple
inheritance, eventually from the same base class) that nobody will
mind a bit if we choose the first option, so that's the one I would
favor.
--
Mark Mitchell                   mark at codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com
    
    
More information about the cxx-abi-dev
mailing list