
Kevin Wheatley wrote:
Dave Harris wrote:
As I said in my previous post, I find the current behaviour quite useful. I sometimes use assert as a convenient way of saying, "issue a warning message, but only in debug builds."
[snip]
used BOOST_ASSERT the same way I use MFC ASSERT. If you're confident no-one has, fine - but I don't see anything in the documentation which says my use is wrong.
That would be me... I use the assert handler functionality to throw an exception during unit testing because the Test library can't deal with assert() very well, but throwing is OK and can be handled and reported far nicer.
You need to be very careful here. If you have asserts in a destructor, they could throw and terminate your tests without any diagnostics! ATL has asserts in several destructors. Ideally, you would want the asserts to become test cases, i.e. CPPUNIT_ASSERT or BOOST_ASSERT but unfortunately, CPPUNIT_ASSERT throws an exception :(. - Reece