|
Boost Users : |
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2007-09-20 07:50:03
Miles Bader skrev:
> Thorsten Ottosen <thorsten.ottosen_at_[hidden]> writes:
>> See
>>
>> http://www.boost.org/libs/ptr_container/doc/reference.html#disabling-the-use-of-exceptions
>
> Ok, I just checked the preprocessed output, and exceptions are _not_
> "disabled", but the boost code seems to contains tons of assertions
> regardless of what mode (exceptions or no_exceptions) is used.
>
>>> Hmmm I didn't explicitly define any macros, but what the compiled code
>>> contains seems to be asserts.
>> Ok, you need to turn assertions off in release mode, perhaps by using
>> -DNDEBUG=1
>
> Well... generally the whole concept of a special no-checking-at-all
> "release mode" is a bit alien here.
>
> I looked at the code and it seems like the basic problem is that the
> boost::ptr_sequence_adapter class (at least) is somewhat
> over-enthusiastic in it's use of assertions:
Just about any boost library has the implicit assumption that assertions
are compiled away *if the optimal efficiency/smallest code is to be gained*.
PtrContainer additionally throws a few exceptions, but these can be
disabled too.
Anyway, to justify why assertions should be disabled in release mode,
I recommed:
http://www.artima.com/cppsource/deepspace.html
In particular, read the section on "The Principle of Removability".
cheers
-Thorsten
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net