Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-11-13 10:25:22

From: "Kevin S. Van Horn" <kevin.vanhorn_at_[hidden]>
> I don't know if you've been following the discussions on use of assert vs.
> throwing exceptions, so here's a capsule summary: for programmer errors
> (violated preconditions) it would be desirable to have some
> error-reporting mechanism that would either throw an exception or do an
> assert(), with the choice depending on a compile-time flag.

Which is what BOOST_ASSERT does. The compile-time flag is the definition of
boost_error that is provided by the user.

> This
> error-check macro would *always* do something,

And *always* doing something in operator->() / operator*() sometimes means
50% performance loss.

> unlike BOOST_ASSERT, which
> does nothing if BOOST_DEBUG is not defined.

To allow turning off all checks when the code has been tested and
performance is critical. If this is not necessary or desirable, you can
always leave BOOST_DEBUG defined.

Peter Dimov
Multi Media Ltd.

Boost list run by bdawes at, gregod at, cpdaniel at, john at