From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2003-05-07 17:31:32
"John Torjo" <john_at_[hidden]> wrote in message
> Hi all,
> (a full-featured ASSERT)
I know there is this thing with macros that makes all boost macros into
BOOST_XX, but for something
that is widely used in "normal" code I would prefer just ASSERT. How many
we clash with for this to happen? Don't MFC uses ASSERT? Anyway, couldn't we
just do something like
#define ASSERT ...
> In case the assertion fails, a meaningful error message will appear,
> somewhat like:
> [file]:[line] Assertion failed: (i > 1) || (j < 0) || (k != i)
> i = 0
> j = 1
> k = 0
> 8. In case an assertion fails, an Assertion Handler will be called, which
> should ask the user whether to continue, break in code, or whatever.
> The default, will allow for:
> - ignore
> - ignore all
> - abort
> - retry (break in code)
> For Win32, I will show a message box, for other platforms, output to cout
> and read from cin.
> (or of course, the user can set its own handler, see point 4.)
I recall that Andrei's assertion macro allowed an exception to be thrown
instead, so you could say
ASSERT<std::runtime_error>( "value too big", i > 0 );
or something. Shouldn't this be a feature? In this respect I would
like to be able to compile an assertion completely away and sometimes
I would like the opposite, that I cannot remove the assertion (and it will
throw an exception).
> 13. Multiple levels of assertion.
> There might be several levels of assertion.
> The normal (default) is Debug - which, in case an assertion fails will
> trigger a message, blabla.
> We can have a "fatal error" level, in which case an exception could be
> For instance, we could have:
> BOOST_ASSERT( i < 1000)(i).level( fatal_err, "value too big!");
would there be that many levels so we couldn't just say .fatal_error( "value
too big!" );?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk