From: md2828 AT mclink DOT it (Marco Salvalaggio) To: djgpp AT delorie DOT com Cc: frenchc AT cadvision DOT com Subject: Re: Large `new' request crashes: help! Date: Wed, 26 Feb 1997 23:38:56 GMT Message-ID: <331fc97c.12394538@newmail.mclink.it> References: <330ED369 DOT 4742 AT cssa DOT org DOT za> <5eqksi$15gq AT elmo DOT cadvision DOT com> In-Reply-To: <5eqksi$15gq@elmo.cadvision.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable 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() 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 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.