Boost logo

Boost :

Subject: [boost] [assert][lightweight_test] Quick review of proposed changes
From: Beman Dawes (bdawes_at_[hidden])
Date: 2011-01-21 11:49:25


In reviewing the "[assert] static_assert envy" thread, I agreed with
Steven Watanabe:

> MHO, the last thing we need is lots of minor variations that
> don't add any real utility.

KISS was also a factor, as I wanted to add only features that I would
personally use right away, or that were needed for BOOST_ASSERT
compatibility.

It boiled down to the following:

[assert]

  * Added BOOST_ASSERT_MSG(expr, msg) macro. If expr is false,
      outputs msg, then calls std::abort().

      BOOST_DISABLE_ASSERTS behaves the same as in BOOST_ASSERT.

      BOOST_ENABLE_ASSERT_MSG_HANDLER enables a separate error handler.

      BOOST_ASSERT_MSG_OSTREAM defaults to std::cerr. User may define to
      specify a different output stream.

  * Added BOOST_ASSERT_MSG test cases to libs/utility/assert_test.cpp

  * Added BOOST_ASSERT_MSG docs to libs/utility/assert_test.cpp

<boost/detail/lightweight_test.hpp> has the same Visual Studio output
interleaving problem, so it makes sense to apply a similar fix at the
same time.

  * Messages are now sent do BOOST_LIGHTWEIGHT_TEST_OSTREAM

  * BOOST_LIGHTWEIGHT_TEST_OSTREAM defaults to std::cerr. User may
    define to specify the output stream for messages.

Updated files:

  http://mysite.verizon.net/beman/assert.hpp
  http://mysite.verizon.net/beman/assert.html
  http://mysite.verizon.net/beman/assert_test.cpp
  http://mysite.verizon.net/beman/lightweight_test.hpp

Let's do a quick review before these get committed to trunk. Say until
Monday morning. (They won't go in 1.46.0; far too late for that.)

Comments welcome!

--Beman


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