Boost logo

Boost :

Subject: Re: [boost] Reforming Boost.System and <system_error> round 2
From: Andrzej Krzemienski (akrzemi1_at_[hidden])
Date: 2018-01-16 14:34:16


2018-01-16 15:22 GMT+01:00 Robert Ramey via Boost <boost_at_[hidden]>:

> On 1/16/18 5:30 AM, Andrey Semashev via Boost wrote:
>
>> On 01/16/18 02:37, Robert Ramey via Boost wrote:
>>
>>> On Can't one just have "if(ec) ..." invoke a syntax error?
>>>
>>
>> Obviously, this will break lots of code for no good reason.
>>
>
> Truth is - If I see this I don't know what it actually means.
> I bet that half the code that would fail to compile is wrong. So I would
> argue that this would UNbreak lots of code.
>
> I think, the understanding of the meaning of such tests is more or less
>> established.
>>
>
> not to me. But maybe that's just me.
>

The semantics of this `if(ec)` is "conditionally well-defined":
provided that you make sure that in all error categories you use throughout
your program zero indicates success and non-zero values indicate failure,
then (and only then) does this construct test if `ec` represents a failure.

Some programs can guarantee that, e.g. if they only use the default
category on Unix.

Regards,
&rzej;


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