Topic: The interpretation of the definition of POD-struct


Author: stepchen@yahoo.com (Chi-Hua Chen)
Date: Wed, 24 Apr 2002 13:29:03 GMT
Raw View
Can anyone tell me what is the correct interpretation of the defintion of
POD-struct in the standard (clause 9 item 4)?

The standard says:

   A POD-struct is an aggregate class that has no non-static data members of
   type pointer to member, non-POD-struct, non-POD-union (or array of such
   types) or reference, and has no user-defined copy assignment operator and no
   user-defined destructor.

Does it mean

   ... of type pointer to member, non-POD-struct, non-POD-union, or
   array of non-POD-union

or

   ... of type pointer to member, non-POD-struct, non-POD-union, array of
   pointer to member, array of non-POD-struct, or array of non-POD-union

Also, is it
   ... of type
   pointer to member,
   non-POD-struct,
   non-POD-union or reference <= reference to/of what?

or
   ... of type
   pointer to member,
   non-POD-struct,
   non-POD-union, <= a comma here
   or reference

Thanks,

Chi-Hua

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]





Author: rhairgroveNoSpam@Pleasebigfoot.com (Bob Hairgrove)
Date: Wed, 24 Apr 2002 16:08:29 GMT
Raw View
On Wed, 24 Apr 2002 13:29:03 GMT, stepchen@yahoo.com (Chi-Hua Chen)
wrote:

>Can anyone tell me what is the correct interpretation of the defintion of
>POD-struct in the standard (clause 9 item 4)?
>
>The standard says:
>
>   A POD-struct is an aggregate class that has no non-static data members of
>   type pointer to member, non-POD-struct, non-POD-union (or array of such
>   types) or reference, and has no user-defined copy assignment operator and no
>   user-defined destructor.
>
>Does it mean
>
>   ... of type pointer to member, non-POD-struct, non-POD-union, or
>   array of non-POD-union
>
>or
>
>   ... of type pointer to member, non-POD-struct, non-POD-union, array of
>   pointer to member, array of non-POD-struct, or array of non-POD-union
>
>Also, is it
>   ... of type
>   pointer to member,
>   non-POD-struct,
>   non-POD-union or reference <= reference to/of what?
>
>or
>   ... of type
>   pointer to member,
>   non-POD-struct,
>   non-POD-union, <= a comma here
>   or reference
>

Hmmm ... I seem to recall seeing footnotes to the effect that "POD is
an acronym for 'Plain Old Data'" ...

Apparently, it means data which is loosely structured and has no
intrinsic type of its own, except as a region of memory ... that's how
I would interpret it.

But don't take my word for it. :-)


Bob Hairgrove
rhairgroveNoSpam@Pleasebigfoot.com

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]





Author: Michiel.Salters@cmg.nl (Michiel Salters)
Date: Thu, 25 Apr 2002 12:13:58 GMT
Raw View
stepchen@yahoo.com (Chi-Hua Chen) wrote in message news:<2e9236ad.0204231256.30660220@posting.google.com>...
> Can anyone tell me what is the correct interpretation of the defintion of
> POD-struct in the standard (clause 9 item 4)?
>
> The standard says:
>
>    A POD-struct is an aggregate class that has no non-static data members of
>    type pointer to member, non-POD-struct, non-POD-union (or array of such
>    types) or reference, and has no user-defined copy assignment operator
>    and no user-defined destructor.
>
> Does it mean
>    ... of type pointer to member, non-POD-struct, non-POD-union, or
>    array of non-POD-union
> or
>    ... of type pointer to member, non-POD-struct, non-POD-union, array of
>    pointer to member, array of non-POD-struct, or array of non-POD-union

The latter. Any non-POD, contained directly or indirectly makes the
aggregate containing it a non-POD too.

> Also, is it
>    ... of type
>    pointer to member,
>    non-POD-struct,
>    non-POD-union or reference <= reference to/of what?
>
> or
>    ... of type
>    pointer to member,
>    non-POD-struct,
>    non-POD-union, <= a comma here
>    or reference

Does it matter? Both mean to me that an aggregate which contains any kind
of reference is not a POD.

You can think of a POD as a type without 'magic' bits, unlike references
and pointers to members. When aggregating types, the aggregate will
certainly contain these 'magic' bits if any member contains them.

Regards,
--
Michiel Salters

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]





Author: "James Kuyper Jr." <kuyper@wizard.net>
Date: Thu, 25 Apr 2002 12:10:28 GMT
Raw View
Chi-Hua Chen wrote:
>
> Can anyone tell me what is the correct interpretation of the defintion of
> POD-struct in the standard (clause 9 item 4)?
>
> The standard says:
>
>    A POD-struct is an aggregate class that has no non-static data members of
>    type pointer to member, non-POD-struct, non-POD-union (or array of such
>    types) or reference, and has no user-defined copy assignment operator and no
>    user-defined destructor.
>
> Does it mean
>
>    ... of type pointer to member, non-POD-struct, non-POD-union, or
>    array of non-POD-union
>
> or
>
>    ... of type pointer to member, non-POD-struct, non-POD-union, array of
>    pointer to member, array of non-POD-struct, or array of non-POD-union

The latter. Notice that "such types" is plural.

> Also, is it
>    ... of type
>    pointer to member,
>    non-POD-struct,
>    non-POD-union or reference <= reference to/of what?

That refers to any reference type. See section 8.3.2 for more details.

> or
>    ... of type
>    pointer to member,
>    non-POD-struct,
>    non-POD-union, <= a comma here
>    or reference

That comma is optional; the sentence has the same meaning with or
without it.

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]