This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [c++] bug 2628 and new
- To: Nathan Sidwell <nathan at codesourcery dot com>
- Subject: Re: [c++] bug 2628 and new
- From: Gabriel Dos Reis <gdr at codesourcery dot com>
- Date: 26 Apr 2001 18:14:58 +0200
- Cc: gcc at gcc dot gnu dot org
- Organization: CodeSourcery, LLC
- References: <3AE83825.A6125602@codesourcery.com>
Nathan Sidwell <nathan@codesourcery.com> writes:
| hi,
| bug 2628 concerns operator new indicating failure by returning NULL, and
| -fno-exceptions.
|
| The user had turned off exceptions with -fno-exceptions and expected
| operator new to indicate failure by returning NULL. What should the
| expected behaviour be?
|
| 1) we could turn on -fcheck-new when -fno-exceptions is enabled. The
| user must replace the system provided operator new.
| 2) we could call operator new (std::nothrow) in place of operator new ().
Hmm, I would suggest calling ::operator new(std::nothrow) only if we
determine that there is no replacement and we're not ending up with a
UDT::operator new.
| 3) we could issue a diagnostic when -fno-exceptions is enabled an
| operator new is called (and any other throw expression?)
A pedwarn?
-- Gaby
CodeSourcery, LLC http://www.codesourcery.com