|
Boost : |
Subject: Re: [boost] Reforming Boost.System and <system_error> round 2
From: Chris Glover (c.d.glover_at_[hidden])
Date: 2018-01-16 14:57:27
> 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.
>
Forgive me for the noise in case I've missed something, but if the primary
concern is that we want to be able to support non-zero success codes, why
not just make the error_category carry the int representation of success
instead of assuming that it's always zero? It's not as generic as
introducing a new virtual that allows one to do whatever (for example there
would still be one blessed value, so you couldn't have different 'success'
values), but it's almost certainly faster than a virtual call, and might
satisfy most of the use cases.
-- chris
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk