Boost logo

Boost :

From: Dean Sturtevant (deansturtevant_at_[hidden])
Date: 2001-01-22 14:01:09


--- In boost_at_[hidden], Gregory Seidman <gseidman_at_a...> wrote:
>Why not just use #ifndef NDEBUG? It keeps things
> consistent with cassert and, like cassert, allows automatic
building of
> debugging and optimized versions. Of course, with any system we
devise it
> is possible for the end programmer to put the #ifndef NDEBUG in his
own
> code, but much of the point of boost is to make less work for the
> programmer.
>
> What is the win of a scheme other than NDEBUG?
>
As with anything, there are tradeoffs. If it was up to me, I'd do
what you suggested. But when I introduced the idea of putting asserts
in boost (last month?), some people objected on the basis that
the 'one definition rule' (ODR) would be violated. They were
concerned that modules compiled with different settings of NDEBUG
might be linked together in the same program. In order to accommodate
them, I proposed using a different namespace (boost_debug) to put
assert-laden code in. This has the drawback that one then needs a
macro to establish the boost namespace, but it does avoid ODR
violations. In fact, this is the technique the STLPort uses.
- Dean


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