|
Boost : |
Subject: Re: [boost] Proposed SG14 <system_error2> ready for feedback
From: mike.dev_at_[hidden]
Date: 2018-03-04 17:00:20
> -----Original Message-----
> From: On Behalf Of Niall Douglas via Boost
> Sent: Saturday, March 3, 2018 11:27 PM
>
> On 03/03/2018 21:11, mike via Boost wrote:
> > I don't claim to understand all the implementation details, so sorry if this
> is dumb question:
> >
> > What happened to the idea to encode failure or success in a single bit in
> the status_code_domain pointer, thus making the check if an operation
> succeeded trivial even in the type-erased case?
>
> That was a potential workaround for Boost.System to not break existing
> code.
>
> A complete rebuild like <system_error2> doesn't need such hacks. It has
> a formal empty state for those users who won't risk the cost of a
> virtual function call. For everybody else, it costs one virtual function
> call at worst, usually not even that as the compiler will have
> speculatively inlined the implementation and/or the linker will have
> implemented the 'final' modifier.
>
It might not be necessary, but wouldn't it be a worthwhile optimization regardless? Even in the generic case it would work without any cross-module analysis and should generally make the compiler's task easier. It would also make the checks for failure or success constexpr (not sure if that is typically relevant).
Or would it imply problematic tradeoffs?
> Niall
Mike
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk