|
Boost : |
From: Marshall Clow (marshall_at_[hidden])
Date: 2002-11-17 21:55:06
At 9:13 PM +0200 11/15/02, Peter Dimov wrote:
>From: "Kevin S. Van Horn" <Kevin.VanHorn_at_[hidden]>
>> 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.
>
>I don't agree. Globally turning asserts into throws at the flip of a switch
>is never the Right Thing(tm) to do. To handle this transition, the code
>needs to be designed with it in mind. Otherwise the approach is, at best, a
>hack: throw an exception and hope for the best.
I must agree.
Consider the following code:
bool DoSomethingWithAPointer ( void *foo ) nothrow () {
BOOST_ASSERT ( foo != NULL );
// do something with foo
}
Ignoring style points and placement of brackets (please), what
happens to that 'nothrow()' clause if BOOST_ASSERT throws?
-- -- Marshall Marshall Clow Idio Software <mailto:marshall_at_[hidden]> Hey! Who messed with my anti-paranoia shot?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk