Date: 2001-11-12 16:13:42
--- In boost_at_y..., Chris Little <cslittle_at_r...> wrote:
> Another possible variant of BOOST_ASSERT is to have a macro that
> message that is display instead of the expression. It would look
> BOOST_ASSERT_MSG( IsOpen(), "The caller should open the file." ) ;
> We've found it helpful to sometimes give an explanation for the
> instead of just the expression.
Yes, I have found that providing an error message is particularly
useful for libraries, where, for the user, line number and file
information pointing deep into library code is not as useful.
I think that it would be useful to standardise a version of assert
that took such a message string.
In "bjp_utilitiesxxx.zip" in the files section I have included an
overloaded version of assert to do this-
assert(bool, const char* s)
(assuming C99-style variadic macros- otherwise the syntax
Also, I have provided versions of assert that can be used for
preconditions and left enabled in a checked build of a library.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk