This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: g++: new that throw bad_alloc ?



> 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).



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]