Boost logo

Boost :

Subject: Re: [boost] [outcome] success-or-failure objects
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2018-01-26 01:14:04


On 25/01/2018 21:32, Niall Douglas wrote:
> Not to nitpick, but as
> https://ned14.github.io/outcome/tutorial/default-actions/happens1/#fn:1
> describes, calling .error() when there is no error there results in
> *hard* UB. As in, the compiler doesn't generate code to handle the
> situation where there is no error, no branches, no stack handling, nothing.
>
> The consequence of that *might* be to proceed as if there is no error,
> but sometimes it is not. The Tutorial gives an example of where it
> segfaults. You can't really say, depends on what the optimiser generates
> for some given situation.
>
> Now, in terms of storage, yes we do always place default initialised E
> in there. That's for the C compatibility. But we don't place a default
> initialised T there, that can be random bits, so .value() where there is
> no value can yield the same random input as you mentioned Outcome v1 had.

Sure. I didn't mean to imply that just because some UB *might* be
relatively benign that you should ever intentionally allow it to happen.
  We're talking about logic errors, where the call was made unintentionally.


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