Boost logo

Boost :

From: Howard Hinnant (howard.hinnant_at_[hidden])
Date: 2007-08-25 16:16:48

On Aug 25, 2007, at 3:10 PM, Peter Dimov wrote:

> Howard Hinnant:
>> I'm strictly looking at this from the client's point of view. I'm
>> the
>> client. I know what I want, and I want to be able to pick something
>> and know what it does. I don't want to be stuck with something that
>> maybe does something, and maybe not. It's like buying something with
>> absolutely no warranty.
> No, I don't agree. This is like saying that if the car you bought
> promises
> 40 MPG and delivers 45, you'd return it because it doesn't meet the
> spec.
> Bad analogies aside, giving the implementation the opportunity to
> check the
> assumptions of your code is not as worthless as you make it to be.
> It does
> not just "add a bunch of undefined behavior", it adds a license for
> the
> implementation to turn the already erratic behavior into a predictable
> assertion failure.
> If the client has used the mutex constructor, this means that his
> code has
> already made the assumption that the condition will be used with
> that mutex.
> If you take away the Requires clause (the "bunch of undefined
> behavior"),
> this will not make the code any more correct and can never be an
> improvement; it would be, at worst, a tie if the implementation did no
> checking.

The main philosophical difference between us is that I want to be able
to choose "check", and be assured that I'm actually getting checking.
And then I want to be able to choose "don't check". And then not have
to pay for it. I want both choices.

What I want:

std::condition<std::constrain<std::mutex>> cv(mut); // I *know* that
if I mix bindings, I will get some kind of noise

And then I want to be able to change that code:

// I *know* that I'm not paying for checking
std::condition<std::mutex> cv(mut); // Either with or without the
"mut", I don't care

With your proposal I write:

std::condition<std::mutex>> cv(mut);

and I don't know whether I have checking or not. All I know is that
I've given permission for the implementation to check. And if I write:

std::condition<std::mutex>> cv;

Then I don't know that I'm not still paying for checking.

I want your (1) and (3). Your (2) gives me neither, not both.


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