New and exception

H. J. Lu hjl@lucon.org
Fri Jul 12 16:09:00 GMT 2002


On Fri, Jul 12, 2002 at 03:54:18PM -0300, Alexandre Oliva wrote:
> On Jul 12, 2002, "H. J. Lu" <hjl@lucon.org> wrote:
> 
> > I was wondering if gcc should translate "new" to "new (std::nothrow)"
> > for -fno-exceptions. When I use -fno-exceptions, I don't expect my
> > codes throw any exceptions, including new.
> 
> I'd rather have such a program crash when new tries to throw an
> exception because it ran out of memory (so that you know what
> happened) than have it crash at some later point due to a NULL-pointer
> dereference.
> 

When I use -fno-exceptions, I can be prepared to deal any returns from
new as long as it doesn't throw an exception, which IS what I am asking
for by using -fno-exceptions and there is no way I can handle any
exceptions since -fno-exceptions is used..


H.J.



More information about the Gcc mailing list