Boost logo

Boost :

Subject: Re: [boost] Reforming Boost.System and <system_error> round 2
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2018-01-16 14:10:10


On 01/16/18 17:06, Peter Dimov via Boost wrote:
> Richard Hodges wrote:
>> Rather than change the meaning of the (ambiguous but no doubt
>> ubiquitous) bool conversion, might it not be better to offer a new
>> method?
>>
>> if (ec.is_error())
> ...
>
> Or ec.failed().
>
> I doubt that we'll be able to change the meaning of `if(ec)` in the
> standard. Although who knows, it's a compatible change in the case
> nobody overrides error_category::failed. Which they don't because it
> doesn't exist yet.
>
> I don't much like `if(ec)`, it's a bit counter-intuitive that it means
> "failed" and not "succeeded". But it's short and idiomatic.

If you spell it "if (err)" or "if (error)", it is very self-explanatory,
IMHO. "if (error.failed())" makes it more verbose without adding any
clarity.


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