Alf P. Steinbach wrote in
On 14 Dec 2003 17:32:44 GMT, Rob Williscroft
I read this:
— If the new-initializer is omitted:
— If T is a (possibly cv-qualified) non-POD class type (or array
thereof), the object is defaultinitialized (8.5). If T is a
const-qualified type, the underlying class type shall have a
user-declared default constructor.
— Otherwise, the object created has indeterminate value. If T is a
const-qualified type, or a (possibly cv-qualified) POD class type
(or array thereof) containing (directly or indirectly) a member of
const-qualified type, the program is ill-formed;
In Andrew Koenig's unofficial revision's list page 20: "Replace
subclause 5.3.4, paragraph 15." (the above from the replacment
part).
http://www.research.att.com/~ark/c++std/2002/pdf/revisions.pdf
I'm sorry to the n'th degree. THIS IS NOT MY DAY. What I wrote was
again incorrect; it seems my thoughts are truly muddled (and I
convinced you of an incorrect reading of the standard). And no, I
didn't party last night. Perhaps a bit of the flu. Also, problems
with electricity supply, snow on the TV image, and more.
I think (from the above) you where right.
Though (to me at least) it doesn't matter as if I want default-
initialization (value-initialization when I get a compiler that
supports it) I would write new T(), I'd only write new T if I knew
that T had a default ctor or for some reason I knew it didn't matter
wether I got a T (or its POD members) which is zero initialized.
Rob.