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
( - I really should update 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, gregod at, cpdaniel at, john at