|
Boost : |
From: Paul A Bristow (pbristow_at_[hidden])
Date: 2007-09-20 06:39:47
>-----Original Message-----
>From: boost-bounces_at_[hidden]
>[mailto:boost-bounces_at_[hidden]] On Behalf Of Guillaume Melquiond
>Sent: 20 September 2007 10:47
>To: boost_at_[hidden]
>Subject: Re: [boost] [numeric/interval] Usage of assert.
>> When adding this include I was wondering why interval doesn't use
>> BOOST_ASSERT? Is there any specific reason for this?
>
>There are mostly two reasons (be they good or bad). First, BOOST_ASSERT
>is not that old. At the time the interval library was designed, there
>was no consensus that all the Boost libraries shall use BOOST_ASSERT.
>(Is there one now?)
>
>Second, most of the assertions in the interval library are for
>detecting
>invariants internally violated, while BOOST_ASSERT is meant to detect
>preconditions a library user did not respect, as far as I understand.
>That being said, the assertion in arith2.hpp is precisely meant to
>detect a misuse of the library, so this one should be BOOST_ASSERT
>actually.
This is a fairly subtle distinction of which I was blissfully unaware ;-)
(And not for the usual lack of RTFM - for a change!).
If there is general agreement with this distinction, perhaps it should be added to the documentation of BOOST_ASSERT? And the
Guidelines?
Paul
--- Paul A Bristow Prizet Farmhouse, Kendal, Cumbria UK LA8 8AB +44 1539561830 & SMS, Mobile +44 7714 330204 & SMS pbristow_at_[hidden]
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk