Actions

icon Post
text/html Subscribe
text/html Unsubscribe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • To: Nathan Sidwell <nathan@xxxxxxxxxxxxxxxx>
  • Subject: Re: [cxx-abi-dev] What is a POD? TC1 or first C++ Standard
  • From: Mark Mitchell <mark@xxxxxxxxxxxxxxxx>
  • Date: Mon, 27 Sep 2004 08:29:00 -0700

Nathan Sidwell wrote:

Mark Mitchell wrote:


Right, good. Again, it looks like G++ 3.4 will treat A as a POD, following TC1, and will therefore not place B::g in the tail padding for A.

From what Dennis, says that sounds like G++ and aCC are incompatible in this respect, but that G++ is probably compatible with (recent versions of) EDG. I'm not sure what the most equitable way to resolve the ambiguity in the ABI specification is.


I recall some example along the lines of,

struct A
{
    T m;
    double d;
    char c;
    void copy_me (A const *s)
    {
        std::memcpy (this, s, sizeof (*this));
    }
};

being valid, so long as A is a POD -- i.e. T does not make it a non-pod.
If that is the case, we should not be reusing the tail padding of
any base class that the _language_ says should be POD.  For instance
when T is a ptr-to-member, or for that matter, when it is an overlong
bitfield.

Yes, you're correct, the standard does guarantee that you can do bitwise copies for PODs using their size. In other words, your point is that unless we interpret the ABI as meaning "TC1 POD", it is not the ABI for a correct C++ compiler, because it will fall afoul of this rule. This is [basic.types]/3, for reference.

I think that's a pretty compelling agument that we should clarify the ABI to indicate that POD means "POD as defined by TC1". Any objections to that proposal? Are there any compilers other than aCC implementing the pre-TC1 definition?

--
Mark Mitchell
CodeSourcery, LLC
(916) 791-8304
mark@xxxxxxxxxxxxxxxx