Boost logo

Boost :

From: Rainer Deyke (root_at_[hidden])
Date: 2001-04-12 23:05:45


----- Original Message -----
From: <williamkempf_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Wednesday, April 11, 2001 11:42 AM
Subject: [boost] Re: any_function (callback) library

> --- In boost_at_y..., "David Abrahams" <abrahams_at_m...> wrote:
> >
> > ----- Original Message -----
> > From: "Peter Dimov" <pdimov_at_m...>
> > To: <boost_at_y...>
> > Sent: Wednesday, April 11, 2001 11:13 AM
> > > "If somebody wants the throwing behavior from 'new' (s)he can
> always add
> > it
> > > atop the other one." :-)
> >
> > How? There is no simple wrapper which can do this.
>
> set_new_handler will handle most cases allowing you to change the
> behavior. Overloading new for specific types also allows you to do
> this. Granted, there are holes in both of these, but so what?

Breaking code which relies on 'new' not throwing would kind of defeat the
purpose of throwing an exception in the first place. Besides, 'new' can
fail at runtime in correct code and therefore must have a way of reporting
errors. If it returns 0 on failure, a wrapper that throws is actually
trivial.

--
Rainer Deyke (root_at_[hidden])
Shareware computer games           -           http://rainerdeyke.com
"In ihren Reihen zu stehen heisst unter Feinden zu kaempfen" - Abigor

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk