From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2543 invoked by alias); 13 Nov 2005 02:13:52 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 2511 invoked by uid 48); 13 Nov 2005 02:13:50 -0000 Date: Sun, 13 Nov 2005 02:13:00 -0000 Message-ID: <20051113021350.2510.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c++/19476] Missed null checking elimination with new In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "sabre at nondot dot org" X-SW-Source: 2005-11/txt/msg01844.txt.bz2 List-Id: ------- 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