Re: [Boost-bugs] [Boost C++ Libraries] #7028: NDEBUG should disable asserts even if BOOST_ENABLE_ASSERT_HANDLER is defined

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #7028: NDEBUG should disable asserts even if BOOST_ENABLE_ASSERT_HANDLER is defined
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-03-15 18:29:30


#7028: NDEBUG should disable asserts even if BOOST_ENABLE_ASSERT_HANDLER is
defined
--------------------------------------+-------------------------------------
  Reporter: mgaunard | Owner: pdimov
      Type: Feature Requests | Status: new
 Milestone: To Be Determined | Component: utility
   Version: Boost Development Trunk | Severity: Problem
Resolution: | Keywords: BOOST_ASSERT assert BOOST_ENABLE_ASSERT_HANDLER NDEBUG
--------------------------------------+-------------------------------------

Comment (by pdimov):

 Interesting point Steven. What do you have in mind? The classic assert(
 expr && "message" )?

 Regarding the main point: the original purpose of BOOST_ASSERT was to be
 exactly equivalent to assert unless overridden by one of the other macros.
 So, when nothing is defined, it maps to assert, and hence honors NDEBUG.
 When BOOST_DISABLE_ASSERTS is defined, this is taken as a request to
 disable BOOST_ASSERT, even when the ordinary asserts are active; and when
 BOOST_ENABLE_ASSERT_HANDLER is defined, for consistency, this is taken as
 a request "route all BOOST_ASSERT macros to this handler, even when the
 ordinary asserts are inactive".

 I can certainly see that in some use cases it is more convenient to make
 it do nothing in NDEBUG configurations even when
 BOOST_ENABLE_ASSERT_HANDLER is defined. Specifically, when BOOST_ASSERT is
 used as a library on its own. Its original purpose, however, was to
 provide a way for Boost libraries to use assertions in a way that can be
 controlled and overridden by the end user. Hence the current behavior.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/7028#comment:16>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:12 UTC