Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-11-04 06:25:26


From: "Kevin S. Van Horn" <Kevin.VanHorn_at_[hidden]>
> A few months ago there was some talk about checking preconditions. In
> some places in the Boost libraries, exceptions are thrown, and in others,
> assert() or its equivalent is used. I mentioned that you generally want
> to core dump when you're debugging, but in many enterprise settings this
> is not acceptable for production code, and it is preferable to throw an
> exception (e.g., abort a single transaction). What you really want is to
> allow the user to choose which behavior you get.
>
> If it does not already exist somewhere in the Boost internals, and nobody
> else is already working on it, I propose to contribute a small debug
> library to Boost.

See boost/assert.hpp. I intend to "fix" its behavior somewhat and document
it for the next release. The new semantics will be

- if BOOST_DEBUG is defined to 0, BOOST_ASSERT will be a no-op;
- if BOOST_DEBUG is not defined or defined to 1, BOOST_ASSERT == assert;
- if BOOST_DEBUG == 2, BOOST_ASSERT(e) will call the user-supplied handler
boost::assertion_failed() when e is false.


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