Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2001-01-22 14:59:00


At 07:01 PM 1/22/2001 +0000, Dean Sturtevant wrote:

>--- 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.

There are already some uses of assert() in boost. They simply include
documented warnings that an ODR violation will occur if NDEBUG is defined
differently in different translation units.

That was as a result of a lengthy discussion, the upshot of which was that
assert() is so valuable that it should be used; just document the ODR
violation potential.

--Beman


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