Subject: Re: [boost] [system] Would it be possible to trial a breaking change to Boost.System and see what happens?
From: Robert Ramey (ramey_at_[hidden])
Date: 2018-01-19 18:02:10
On 1/19/18 9:16 AM, Vinnie Falco via Boost wrote:
> Nobody wants to write
> if(ec == my_condition::success)
LOL - I want to write this.
> When then can instead write
> if(! ec)
> Even in your own code you write `if(! ec)`:
And when I do I want to consider it a mistake.
> Whether it was intended or not, established practice is to treat the bool
> conversion of error_code as false==success and true==failure.
It may be established, but it's not good practice. It's an example where
implicit conversion SEEMS to make things simpler and more expressive,
but it ends up making things more error prone.
> I have long felt that the documentation for <error_code> and <error_condition>
> is terribly inadequate which probably accounts for the pervasive misconceptions.
Agreed. Personally I can never remember the details of any of these
things and I'm constantly going back to lookup how they are to be used.
In the case of system_error - I like it, but I have to go back to
Chris's web page every time to remember the details on how to use it.
It's too clever for me to remember.
> The standard is completely unhelpful in offering guidance on its use, and all of
> the usual websites (cppreference.com or the boost docs for example) are
> similarly unhelpful.
> Chris' blog posts on error_code were instructive but
I found this the most useful.
> Andrezj's blog posts did the best job of providing tutorial-like
> guidance but of course I read them too late.
> People are still trying to figure out how to use error_code and having trouble
> because it isn't well explained. Ideas like "if(! ec)" should not be used to
> check for success do nothing to improve this situation.
This situation is unfortunate and applies to many libraries including
Boost and the standard library. I've been trying to promote the
addressing of this, but it's not easy for a number of reasons. I do
feel a tiny bit of progress is being made. Just a fact that
questions/complaints of this nature are raised more frequently is a good
sign. Still, the situation is very frustrating.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk