Boost logo

Boost :

From: Toon Knapen (toon.knapen_at_[hidden])
Date: 2001-11-12 09:19:05

Peter Dimov wrote:

> From: "Toon Knapen" <toon.knapen_at_[hidden]>
>>Peter Dimov wrote:
>>>See the code at the end for my proposed implementation of BOOST_ASSERT.
>>>Design goals:
>>>* Simple;
>>On C99 compatible compilers you can also indicate the function in which
>>the assert occured using __func__ (in addition to __LINE__ and __FILE__)
>>(e.g. gcc-2.95.x and newer do this in their assert)
>>Ideally would also be to have a stacktrace-dump when an assert occurs
>>(and the user would want this). The only way I see to do this is to
>>insert in debug-mode a small object in every function which is going to
>>register the function in a stack in some singleton (using __func__). If
>>the program aborts, you thus print the content of the stack in the
>>singleton to std::cerr. However, some might find this to intrusive ?
> See design goal #1 above. :-)

`Simple` is a relative term. I guess your main concern is 'simple to
use'. Adding the __func__ keeps it simple (although the implementation
now will have to distinguish between C99 compatible and non-compatible
compiler, thus it will become less simple to implement).

The intrusiveness of the stack-tracing functionality would indeed make
it less `simple to use` (because all function entry points need to be


Boost list run by bdawes at, gregod at, cpdaniel at, john at