Boost logo

Boost :

From: Valentin Bonnard (Bonnard.V_at_[hidden])
Date: 1999-08-31 12:08:16


Beman Dawes wrote:

> The real question is whether to stick with assert() or try to develop
> something along the lines of assertion<>(). It seems to me that
> assertion<>() meets identified needs:
>
> * Code usually optimized away if not active.

Need a compile time constant to do that.

> * Avoids ODR violations.

Need an external variable initialised only once.

These tend to conflict.

I can see a solution, but it depends on the way #include
works:

/users/bonnard/test.cc:
> #include <boost/assert.hpp>

/usr/include/boost/assert.hpp:
> #include "debug_mode.hpp"

/users/bonnard/debug_mode.hpp:
> extern const bool debug_mode;
> const bool debug_mode = true;

But it depends on a <> header being able to
include a "" header. (Sun cpp says no, it won't
work.)

> * Avoids possibly harmful macro usage.
>
> Needs identified so far that assertion<>() doesn't meet :
>
> * Reporting of file and line.

These are contradicting. We must choose.

> * Parameterization of exception type.

If it's only used for debugguing, it is worth the
complexity ?

-- 
Valentin Bonnard

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