Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 2001-06-11 13:06:51


----- Original Message -----
From: "Paul A. Bristow" <pbristow_at_[hidden]>
> Re-packaging C++ style is easy enough,
> but I would like guidance on how to handle the exceptional
> conditions.
>
> For example, if the probability is outside the range 0 to 1,
> the result cannot be calculated because the parameter is wrong.

A recent discussion on when to use exceptions concluded, I believe, that
exceptions should be used when the error condition cannot be reasonably or
easily checked by the caller
(http://groups.yahoo.com/group/boost/message/11034) - I really should update
http://www.boost.org/more/error_handling.html to reflect this. This sounds
like a case which should be handled via a precondition/assertion rather than
an exception.

> Should this be handled using exceptions, and if so exactly how, showing
> as much info as possible. In this case, p is out of range 0 to 1 and
> its erroneous value is useful. In other cases, other parameters can be
> wrong (negative degrees of freedom), or the calculation itself can fail.
> Worked examples please!

This one, too.


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