This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/19476] Missed null checking elimination with new
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 13 Nov 2005 02:10:46 -0000
- Subject: [Bug c++/19476] Missed null checking elimination with new
- References: <bug-19476-6528@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #6 from pinskia at gcc dot gnu dot org 2005-11-13 02:10 -------
(In reply to comment #5)
> Is this safe? People can define their own operator new's, some of which may
> return null...
Yes because the normal operator new guarante not to return NULL by the C++
standard. And if it returns a NULL that is undefined behavior, it should be
throwing an exception when memory could not be allocated (there is a nonthrow
version which can and will return NULL).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19476