Subject: Re: [boost] Reforming Boost.System and <system_error> round 2
From: Robert Ramey (ramey_at_[hidden])
Date: 2018-01-15 23:37:46
On 1/15/18 1:18 PM, Niall Douglas via Boost wrote:
> That leaves the request to fix "if(ec) ..." which right now returns true
> if the value is 0, despite that much code writes "if(ec) ..." to mean
> "if error then ...". There is also the issue of error coding schemes not
> being able to have more than one success value, which usually must be 0.
> That's the remaining discussion point.
I apologize for parachuting into the discussion ... But ...
Can't one just have "if(ec) ..." invoke a syntax error? Perhaps by
deleting or doing a static_assert on the conversion to bool? This would
require that the user use "if(ec == my_error_code::success) or if(ec ==
my_error_condition::stupid_error) or whatever. This would eliminate
lot's of stupid errors and leave the code simpler. It would also
eliminate hours and hours and hours of discussion as too what "if(ec)
... " should mean.