This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
C++: operator new and disabled exceptions
- From: Christophe LYON <christophe dot lyon at st dot com>
- To: gcc at gcc dot gnu dot org
- Date: Fri, 28 Sep 2007 14:53:46 +0200
- Subject: C++: operator new and disabled exceptions
Hello,
I have already asked this question on gcc-help (see
http://gcc.gnu.org/ml/gcc-help/2007-09/msg00328.html), but I would like
advice from GCC developers.
Basically, when I compile with -fno-exceptions, I wonder why the G++
compiler still generates calls to the standard new operator (the one
that throws bad_alloc when it runs out of memory), rather than
new(nothrow) (_ZnwjRKSt9nothrow_t) ?
In addition, do you think I can patch my GCC such that it calls
new(nothrow) when compiling with -fno-exceptions, or is it a bad idea?
(compatibility issues, ...)
Thanks for your recommendation,
Christophe.