Mail Archives: djgpp/1997/02/26/18:47:38
On Sun, 23 Feb 1997 12:23:42 GMT, you wrote:
>
>Don't have an exacty answer for you, but Borlands compiler let you set
>a callback function that would get called whenever new failed. The
>function was called set_new_handler(<whatever>) I think. If new fails
>it should still return zero, so you could set_new_handler to a dummy
>function (or there is probably a better solution) and just test for a
>zero...
>
>- Calvin -
>
set_new_handler() is not a Borland extension but a function that appears =
in
the standard C++ draft. Here's its definition (from the 25 April 1995
draft):
-------------------------------------------------------------------------=
------------------
18.4.2.3 set_new_handler
new_handler set_new_handler(new_handler new_p);
Effects: Establishes the function designated by new_p as the current
new_handler.
Returns: the previous new_handler.
-------------------------------------------------------------------------=
------------------
Where new_handler is defined as follow:
=20
typedef void (*new_handler)();
Djgpp supports it, you'll have to include <std/new.h>
A better way to trap a new failure should be catch the standard defined
bad_alloc exception, but this one is not present in djgpp.
Marco.
- Raw text -