This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/19476] Missed null checking elimination with new



------- Comment #7 from sabre at nondot dot org  2005-11-13 02:13 -------
> Yes because the normal operator new guarante not to return NULL by the C++
> standard.

Sure.

> 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).

Sure, fine, but you need not be calling the default/normal operator new.  I can
define an overload for operator new in a different translation unit, or even by
dynamically loading a library with a different one.  This is similar to
replacing malloc.  AFAICT, the C++ std does not say that the replacement
operator new may not return null.

-Chris 


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19476


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]