|
Boost : |
Subject: Re: [boost] [system] Would it be possible to trial a breaking change to Boost.System and see what happens?
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2018-01-12 18:40:51
On 01/12/18 21:32, Peter Dimov via Boost wrote:
> Andrey Semashev wrote:
>
>> In my code I'm using contextual conversion to bool extensively, e.g.
>> "if (err)" or "if (!err)". This is currently equivalent to comparing
>> against 0, so I assume it will be broken by this change.
>
> It will only be broken if you rely on `error_code( 0, some-category )`
> to contextually-convert to `false`.
I'm not sure how I can *not* rely on that since I construct `error_code`
from enums or ints, all of them having 0 as the "success" value
precisely to allow the contextual conversion produce the intended result.
> A principled approach would be to ask the category whether a code is
> `true` or `false`, but that might be complexity and overhead nobody needs.
True.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk