Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-11-14 09:24:50


From: <Msk_at_[hidden]>
> I heartily agree with the other boosters who have suggested
> putting more detailed information into diagnostic messages.
> I've used a system where we actually included the values
> of relevant variables in the messages, as well as a brief
> explanation of what went wrong, and that was very nice
> information to have. However, in order for that to be
> workable you need an easy, concise way to format the strings.
[...]

This is a facility that would be an useful addition to Boost, but it's not
the intent of BOOST_ASSERT to cover this functionality.

The primary audience of BOOST_ASSERT are boost library authors, not end
users.

Of course end users would be welcome to use BOOST_ASSERT if it happens to
work adequately for them, but whenever there is a "conflict of interest"
between the two groups, boost developers have a priority.

--
Peter Dimov
Multi Media Ltd.
Proposed boost/assert.hpp:
bool boost_error(char const * expr, char const * func, char const * file,
long line);
#ifndef BOOST_ERROR
#ifdef __GNUC__
#define BOOST_ERROR(expr) ((expr) || !boost_error(#expr,
__PRETTY_FUNCTION__, __FILE__, __LINE__))
#else
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901)
#define BOOST_ERROR(expr) ((expr) || !boost_error(#expr, __func__, __FILE__,
__LINE__))
#else
#define BOOST_ERROR(expr) ((expr) || !boost_error(#expr, "(unknown)",
__FILE__, __LINE__))
#endif
#endif
#endif
#ifdef BOOST_DEBUG
#include <assert.h>
#ifndef BOOST_ASSERT
#ifndef NDEBUG
#define BOOST_ASSERT(expr) assert(BOOST_ERROR(expr))
#else // #ifndef NDEBUG
#define BOOST_ASSERT(expr) BOOST_ERROR(expr)
#endif // #ifndef NDEBUG
#endif // #ifndef BOOST_ASSERT
#else // #ifdef BOOST_DEBUG
#undef BOOST_ASSERT
#define BOOST_ASSERT ((void)0)
#endif // #ifdef BOOST_DEBUG

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