Mail Archives: djgpp/1997/05/08/10:18:42
Jimmy OBERTAN wrote:
>
> Why the new call exits when there is not enough memory?
quoting from "The C++ Programming Language", 2nd ed. p.312
"If operator new() cannot find memory, it calls _new_handler(). If
(_new_handler() ) cannot supply enough memory, the handler cannot return
to operator new() without causing an infinite loop."
hence, so long as you do not provide your own _new_handler(), the
default behavior of terminating the program is a sensible choice. if you
want different behavior, you need to write your own _new_handler() and
use set_new_handler to notify the particular class' operator new().
consult a C++ book for details.
--
Sinan
*******************************************************************
A. Sinan Unur WWWWWW
|--O+O
mailto:sinan DOT unur AT cornell DOT edu C ^
http://www.people.cornell.edu/pages/asu1/ \ ~/
Unsolicited e-mail is _not_ welcome, and will be billed for.
*******************************************************************
- Raw text -