Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-07-21 12:51:12


"Peter Dimov" <pdimov_at_[hidden]> writes:

> Russell Hind wrote:
>> David Abrahams wrote:
>>>
>>> Well, that's not my philosophy FWIW. Mine is:
>>>
>>> if the condition is a programmer error, use assert
>>> otherwise, use a well-documented exception
>>>
>>
>> So can I draw you back to the original question of why a locked
>> scoped_lock throws rather than asserts? The only thing that can cause
>> this is calling lock on it twice which is a programming error, isn't
>> it?
>
> It's not that simple. Whether something is a programming error is determined
> by the library's specification, not vice versa. In other words, under the
> current specification, re-locking a locked lock :-) is not an error, as it
> is well defined. It is not a just an implementation question of using assert
> or throw, it is a design question.

For the record, Peter is saying what I would have said. Only he's
saying it much better.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk