Boost logo

Boost :

Subject: Re: [boost] [concept] forward declarations and `BOOST_CONCEPT_REQUIRES()`
From: Stefan van Kessel (van_kessel_at_[hidden])
Date: 2010-08-10 18:14:56


On 8/10/2010 11:20 PM, Stephan T. Lavavej wrote:
> Please note that NDEBUG controls the assert() macro. NDEBUG can be defined or undefined by the user at will, even repeatedly within a translation unit (see C99 7.2/1).
>
> _DEBUG is defined by VC when compiling in debug mode (with the /MTd or /MDd options), and not when compiling in release mode (with the /MT or /MD options). It must not be defined or undefined by the user. (Technically, defining it when it's already defined, and vice versa, is harmless, but the user shouldn't do that. The IDE does that for its own reasons.)
>
> Despite their similar names, NDEBUG and _DEBUG are totally different. It sounds like you shouldn't be testing NDEBUG here.
>
> (If VC10, aka 1600, is doing something wrong here, I'd like to know about it - with a self-contained repro.)
>
> Stephan T. Lavavej
> Visual C++ Libraries Developer

My mistake. Whether the build mode is debug or not (/MTd || /MDd) is
unrelated. It was just my first assumption because switching to release
mode made it compile (since it per default includes /D "NDEBUG").

Since the #define for BOOST_CONCEPT_REQUIRES that is switched to under
those conditions discards the models i.e. concept requirements, I
suppose it was a design decision for the BOOST_CONCEPT_REQUIRES to act
like assert in respect to whether it actually does any testing in
presence of NDEBUG.


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