|
Boost : |
From: David Abrahams (abrahams_at_[hidden])
Date: 2001-04-11 10:29:43
----- Original Message -----
From: "Peter Dimov" <pdimov_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Wednesday, April 11, 2001 11:13 AM
Subject: Re: [boost] any_function (callback) library
> From: "David Abrahams" <abrahams_at_[hidden]>
>
>
> > I tend to agree with Jesse here. If somebody wants the throwing behavior
> > (s)he can always add it atop the other one.
>
> "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.
> > If not, there is no recourse.
>
> Why would you want a recourse? The undefined behavior doesn't buy you
> anything.
It buys you the ability to take actions which may be more appropriate than
throwing an exception.
> If you never call an empty function, you'll never get an
> exception.
As I have previously posted, throwing an exception in place of an assertion
can make misuse much harder to debug. An assertion stops the program at the
point of the violation without changing its state, often producing a core
dump or other information which can be used to look at the program state in
a debugger. An exception causes stack unwinding and other reactions which
can obscure the cause of the problem.
It comes down to a question of definitions: is passing a 0 to the
constructor misuse, or is it allowed? If it's misuse I want an assertion.
-Dave
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk