Boost logo

Boost :

Subject: Re: [boost] Proposed SG14 <system_error2> ready for feedback
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2018-03-04 21:46:05


>> 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.
>
> It might not be necessary, but wouldn't it be a worthwhile optimization regardless?

As I mentioned, it has a formal empty state. No further optimisation is
needed. It is as efficient as is possible.

> 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?

Unlike with <system_error>, with <system_error2> the implementation of
the domain may be exposed to all translation units using it (i.e. if you
use the typed status_code<DomainType>, then by definition DomainType
must be visible to all translation units).

The compiler generally does the right thing when it can see a 'final'
implementation. So if you want maximum optimisation, never use the type
erased forms of status_code.

Niall

-- 
ned Productions Limited Consulting
http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk