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] non-public non-static members vs POD layout


  • To: scott douglass <scott.douglass@xxxxxxx>
  • Subject: Re: [cxx-abi-dev] non-public non-static members vs POD layout
  • From: Mark Mitchell <mark@xxxxxxxxxxxxxxxx>
  • Date: Mon, 28 Apr 2008 15:59:54 -0700

Scott --

My personal opinion is that the ABI does not guarantee that "almost" PODs are laid out as PODs. In fact I think it says that such things must be laid out using the rules in the C++ ABI -- surprising though that might be.

Also since the ABI predates TC1, the inclusion of pointers to members on PODs should not apply. I suppose the spec would explicitly say "PODs as defined prior to TC1"

Does anyone object to making that change?

--
Mark Mitchell
CodeSourcery
mark@xxxxxxxxxxxxxxxx
(650) 331-3385 x713

On Apr 16, 2008, at 2:34 AM, scott douglass <scott.douglass@xxxxxxx> wrote:

Hi,

If a class or union has non-public non-static members it is non-POD
(because it's not an 'aggregate' in 8.5.1).

The C++ ABI (2.2) delegates layout of PODs to the base (C) ABI and
specifies layout of of POD types itself.

Does/should the C++ ABI guarantee than a class that is non-POD only
because of non-public non-static members has the same layout as the
corresponding POD class in cases where any tail-padding cannot be
reused?  (Is base-class subobject the only case where tail-padding can
be reused?)

Also, a minor quibble:  since TC1 PODs can contain pointer-to-members
and the base (C) ABI determines their layout, should it be mentioned
more explicitly in 2.2 how they are layed out (as is done for 'bool').

Thanks.


--
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.