From: David Abrahams (dave_at_[hidden])
Date: 2002-11-03 13:11:03
I support the direction you're going in.
"Kevin S. Van Horn" <Kevin.VanHorn_at_[hidden]> writes:
> 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. The intent is that this library both be used internally
> to Boost and also made available to Boost users. Here are the essentials:
> 1. There are macros BOOST_DBG_ASSERT(e) and BOOST_DBG_ASSERT_MSG(e, msg).
> These check that e is true, and either cause an abort or an exception
> throw if e is false. The second form allows one to give additional
> explanatory information if e is false.
> 2. If BOOST_NDEBUG is defined, then both of the above two macros are
> 3. If BOOST_NDEBUG is not defined but BOOST_DEBUG_THROW is defined, then
> the DB_ASSERT macros throw an exception containing the test expression,
> file number, line number, and (optional) explanatory message.
> Over time I expect that additional debug facilities would be added to this
> library, in response to user input. For example, I think it would be useful
> to have facilities that make it easy to define checked iterators such as exist
> in STLport's debug mode. However, I think it best to start with the
> smallest useful unit of functionality.
> I also would like to get more familiar with the Boost internals, and as I
> review the code for various libraries I expect to be submitting patches /
> enhancements that make use of the new debug facilities.
-- David Abrahams dave_at_[hidden] * http://www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk