|
Boost : |
From: Jon Kalb (jonkalb_at_[hidden])
Date: 2002-11-15 15:25:58
> -----Original Message-----
> From: Kevin S. Van Horn [mailto:Kevin.VanHorn_at_[hidden]]
> Sent: Friday, November 15, 2002 9:00 AM
> To: boost_at_[hidden]
> Subject: Re: [boost] Proposed Boost Assert -- once again
>
>
> Peter Dimov write:
>
> > Throwing an exception from BOOST_ASSERT is undesired
> > behavior. I don't want it as a standard option.
>
> Except that, in the case I pointed out, it sometimes is
> desired behavior
> and the Right Thing(tm) to do. One aborts an entire subcomputation /
> transaction rather than aborting the entire program. I
> expect this to be
> the norm, not the exception (pardon the pun), for enterprise
> information
> systems. Because it is a common, important case, it is
> desirable that we
> provide a standard solution for this case. If you like, the
> documentation
> can make it clear exactly under which circumstances use of the
> exception-throwing behavior is desirable, and when it is not.
In my opinion, and I think this is where Peter is coming from, if
throwing an exception is the right thing to do, then the situation is an
expected (if exceptional) case. In that situation, an assertion is not
appropriate.
In the situation that you outline above, it appears to me that you are
planning to use BOOST_ASSERT() in "shipping" (deployed?) code. If that
is your plan, you are not using BOOST_ASSERT() as an assertion, but as a
run-time check. There is certainly nothing wrong with runtime checks
that throw, but I think calling them "assertions" is inconsistent with
the traditional software engineering meaning of the word and a
disservice to others working with your code.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk