Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 2001-03-17 14:43:41


IMO using the question "is this an exceptional situation?" to decide whether
to throw an exception has an attractive ring to it, but is usually a
mistake. A more appropriate question to ask is: "do we want stack unwinding
here?"

As a developer, if I have violated a precondition of a library I'm using, I
don't want stack unwinding. What I want is a core dump or the equivalent - a
way to inspect the state of the program at the point where the problem was
detected. That usually means assert() or some equivalent.

I have sympathy with the idea of making resilient APIs which can stand up to
nearly any kind of client abuse, but there is usually a significant cost to
this approach. If someone wants that sort of protection, it can usually be
provided as a layer on top of a simpler API. I am utterly unsympathetic to
half-measures, though. An API which promises resilience against some, but
not all abuse is an invitation to disaster.

-Dave
----- Original Message -----
From: <williamkempf_at_[hidden]>
> >
> > Most programmer errors are "serious errors that result in
> exceptional
> > conditions".
>
> That I don't agree with. A very large number of errors do not rise
> to the point of "exceptional condition". The difficulty is that
> often developers disagree on specific errors, which I think is the
> case here. So, let me defend my stance a little better.


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