g++: new that throw bad_alloc ?
Joe Buck
jbuck@synopsys.com
Mon Oct 13 09:40:00 GMT 1997
> I think I'd agree with the conclusion... but isn't the old-style
> behavior of new to return NULL?
The behavior of g++ 2.7.2.x is that NULL is never returned; rather,
you get a message "virtual memory exhausted" and the program exits.
It's possible to install a new_handler to get memory in some other
way.
That's why I said it's safe.
Code that wants to check the value of new needs to use the new nothrow
new (as specified in the CD2).
More information about the Gcc
mailing list