Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2007-08-22 22:10:58


on Wed Aug 22 2007, "Peter Dimov" <pdimov-AT-pdimov.com> wrote:

> Howard Hinnant wrote:
>
>> On Aug 22, 2007, at 7:14 PM, David Abrahams wrote:
>>
>>> The reason is, "Peter said so." In other words, if you accept Peter's
>>> modification, the contract says "if you construct it this way, it's a
>>> logic error to use it that way."
>>>
>>> I don't see a problem with that.
>>
>> Ok, so what if Howard says: If you construct it this way, it's a run
>> time error to use it the that way. Is that statement in any way more
>> or less correct?
>
> Howard actually says that using it that way results in an exception, and
> this statement isn't more or less correct. It's just different.

Right.

If we can compare the correcness of those two contracts at all, the
correctness of throwing depends on whether there's a use case that can
reasonably recover. As far as I can tell, there's no realistic
scenario in which it's not a programming error (so far the best we've
come up with is "the user selects the mutex via std::cin"), and you
can't really recover from programming errors at runtime.

It's all in this thread: http://tinyurl.com/2ph58t

-- 
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com
The Astoria Seminar ==> http://www.astoriaseminar.com

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