Mail Archives: djgpp/1998/05/13/11:33:50
>Is it possible to set this up to be the default behavior my modifying
>some startup file or other? So you don't have to keep doing it in
>every program?
Yes and no...
Include this .cc file in a project.
// foo.cc
// Fixes the new handler "bug".
#include <new>
void __my_new_handler (void) {
throw bad_alloc();
}
class __dummy_class {
__dummy_class (void) { set_new_handler(__may_new_handler); }
};
__dummy_class __dummy_object; // This will construct at startup, and the
// constructor will
set the new handler.
In another module, such as the one with main, #include this:
// foo.h
extern __dummy_class __dummy_object; // Force linker to link the foo.o.
--
.*. "Clouds are not spheres, mountains are not cones, coastlines are not
-() < circles, and bark is not smooth, nor does lightning travel in a
`*' straight line." -------------------------------------------------
-- B. Mandelbrot |http://www3.sympatico.ca/bob.beland/indexn2f.html
_____________________ ____|________ Paul Derbyshire pderbysh AT usa DOT net
Programmer & Humanist|ICQ: 10423848|
David Vrabel wrote in message <35599b32 DOT 1408551 AT 192 DOT 168 DOT 1 DOT 250>...
>
>David.
>
>David Vrabel d DOT vrabel AT n-shropshire DOT ac DOT uk
>A poor student (aren't they all) at:
>North Shropshire College
>Oswestry, Shropshire, UK
- Raw text -