Boost logo

Boost :

Subject: Re: [boost] [system] Would it be possible to trial a breaking change to Boost.System and see what happens?
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2018-01-22 18:59:32


> I would prefer writing `if(ec.success())` and `if(ec.failed())` over
> `if(! ec)` and `if(ec)` respectively.
>
> Which brings up an interesting idea. Perhaps we can first propose to
> add `error_code::success()` and `error_code::failed()` and get that
> in, as an immediate improvement over writing legible code. And
> deprecate (but do not forbid) the use of the `bool` conversion. Then
> after several years and more experience in the field contemplate the
> change allowing `error_category` to define the meaning of success,
> secure in the knowledge that any code which is written or modified to
> use `success()` and `failed()` will automatically work.

If `ec.success()` and `ec.failure()` call virtual functions on their
category to return whether a code is success or failure, that works for
me. It's a reasonable compromise, and doesn't change existing code.

Niall

-- 
ned Productions Limited Consulting
http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/

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