[cxx-abi-dev] What is a POD? TC1 or first C++ Standard

Kerch Holt kerch at cup.hp.com
Fri Sep 24 17:14:39 UTC 2004


Mark -

Here is a test case that shows the difference.
Kerch
----------------------------------
struct S {  // POD after TC1 change
     int S::*pm;
     char c;
};
struct R {
};

struct T : public S , public R {
     char i;
     double d;
};

int main () {
     T t;
     return (((int)&t.i) - (int)&t); // aCC5 gets 5, aCC6 gets 8
}

Mark Mitchell wrote:
> Dennis Handly wrote:
> 
>>> GCC is not going to change back to the pre-TC1 definition, even for
>>> return values
>>>   
>>
>>
>> What do you mean by "return values"?  I said it only affects layout.
>> I first thought it also affects them but 3.1.4 Return Values, says 
>> nothing
>> about PODs.
>>  
>>
> You are correct.  I thought it said that non-PODs could not be 
> passed/returned in registers, but, in fact, it is more specific: it 
> talks about non-trivial copy constructors and destructors.
> 
> That makes things somewhat simpler.
> 
> It seems to me that a POD with a pointer-to-member data member should 
> not be a "POD for purpose of layout" because the layout of a "POD for 
> the purpose of layout" is supposed to be whatever the C ABI would 
> require -- and the C ABI does not specify the layout of a type 
> containing a pointer-to-member.
> 
> Now, the question is, when would this make a difference?  Dennis, can 
> you post a small test case showing where the layout is different 
> depending on whether you use the TC1 or pre-TC1 definition of POD?
> 

-- 
Kerch Holt                 kerch at cup.hp.com
HP Java, Compilers, and Tools Lab (JCTL)
11000 Wolfe Rd. MS 4023
Cupertino, CA    95014     408-447-0421





More information about the cxx-abi-dev mailing list