New and exception

Alexandre Oliva aoliva@redhat.com
Fri Jul 12 16:17:00 GMT 2002


On Jul 12, 2002, "H. J. Lu" <hjl@lucon.org> wrote:

> When I use -fno-exceptions, I can be prepared to deal any returns from
> new as long as it doesn't throw an exception

That's hardly possible, unless you're using new as a shorthand for
malloc.  new often calls ctors, and there's no way you can interpose a
NULL-test between the return from operator new and the ctor call.
Besides, if you really mean to do it and modify your program to do so,
there's no reason for you to not use the nothrow variant of new
already.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer



More information about the Gcc mailing list