Topic: operator new(0) != 0
Author: Stephan Bergmann <stephan.bergmann@sun.com>
Date: Mon, 15 Oct 2001 17:47:30 GMT Raw View
Hi all.
The standard requires operator new(0) to return a non-null pointer, and
Scott Meyers' "Effective C++" mentions that this simplifies other parts
of the standard---can anybody enlighten me as to what these other parts
are?
Thanks,
Stephan
---
[ 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.research.att.com/~austern/csc/faq.html ]
Author: joerg.barfurth@attglobal.net (Joerg Barfurth)
Date: Mon, 15 Oct 2001 23:12:09 GMT Raw View
Hi Stephan,
Stephan Bergmann <stephan.bergmann@sun.com> wrote:
> Hi all.
>=20
> The standard requires operator new(0) to return a non-null pointer, and
> Scott Meyers' "Effective C++" mentions that this simplifies other parts
> of the standard---can anybody enlighten me as to what these other parts
> are?
Actually the FDIS wasn't entirely clear. There was a defect report in
that area (see
http://anubis.dkuug.dk/JTC1/SC22/WG21/docs/lwg-defects.html#9).
>From that issue I gather that 5.3.4/7 is tightly linked to that
statement and also that 18.4.1 may be affected.=20
It also mentions that these semantics were already specified in the ARM.
The DR resolution also makes it legal for such an allocation to fail -
in which case the operator new must either throw bad_alloc or return
NULL (if throw()) iirc.
HTH, J=F6rg
--=20
J=F6rg Barfurth joerg.barfurth@attglobal.net
<<<<<<<<<<<<< using std::disclaimer; <<<<<<<<<<<<<<<<<<<<<<<<<<<<
Software Developer http://www.OpenOffice.org
OpenOffice.org Configuration http://www.sun.com/staroffice
---
[ 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.research.att.com/~austern/csc/faq.html ]