Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2001-03-18 09:42:37


At 10:31 PM 3/17/2001, David Abrahams wrote:

>Moreover, I am not at all convinced it is appropriate for our libraries
to
>attempt to check for client abuse. If and where we /do/ decide it is
>appropriate, I agree with the idea of using configurable response
>strategies. I also believe it is usually best to put these checks in a
>separate layer on top of the base implementation, rather than trying to
>weave them into the release code.

Sometimes assert() and only assert() is clearly the Right Way.

Sometimes throwing an exception, and only that, is clearly the Right Way.

But it sounds like what we are talking about here are cases where neither
one of those is clearly the Right Way.

So perhaps we need a BOOST_ASSERT(), which has at least three behaviors
(determined by what preprocessor symbols are defined) when the predicate
fails:

   * classic assert() with -NDEBUG not defined.

   * classic assert() with -NDEBUG defined.

   * throw logic_error (with file/line info?).

   * [possibly?] call some user or system function (with file/line info?).

Note that the use of BOOST_ASSERT() would be part of the function's
interface (rather than just QOI) because user code may rely on some of the
behavior choices.

Comments?

--Beman


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