[numeric/interval] Usage of assert.

Hello, I just committed a small fix to arith2.hpp, adding a missing #include <cassert> to the header. This fixes the current breakage of the trunk on Tru64. When adding this include I was wondering why interval doesn't use BOOST_ASSERT? Is there any specific reason for this? Markus

Le jeudi 20 septembre 2007 à 09:40 +0200, Markus Schöpflin a écrit :
Hello,
I just committed a small fix to arith2.hpp, adding a missing #include <cassert> to the header. This fixes the current breakage of the trunk on Tru64.
Thanks.
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. Thanks for pointing it out, I will review the various uses of assert in the new interval library. Best regards, Guillaume

-----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Guillaume Melquiond Sent: 20 September 2007 10:47 To: boost@lists.boost.org 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@hetp.u-net.com
participants (3)
-
Guillaume Melquiond
-
Markus Schöpflin
-
Paul A Bristow