Boost logo

Boost :

Subject: Re: [boost] [review] Review of Outcome v2 (Fri-19-Jan to Sun-28-Jan, 2018)
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2018-01-27 20:49:04


On Fri, Jan 26, 2018 at 7:57 PM, Niall Douglas via Boost <
boost_at_[hidden]> wrote:

> > Question: if using the OUTCOME_TRY macro is equivalent to calling the
> > function, checking for error and then returning an error if there is an
> > error, how is this different from using exceptions? Semantically,
> exception
> > handling does nothing more than check for errors and returning errors if
> > there were errors, with much more readable syntax:
>
> Semantically they are similar, and if the compiler implements EH using
> SJLJ or any of the non-table approaches, they are also pretty much
> identical in terms of implementation.
>

I was only talking about semantics. Are you saying that, except for
performance considerations, there is no reason to use

OUTCOME_TRY(handle, open_file(path));
OUTCOME_TRY(buffer, read_data(handle));
OUTCOME_TRY(val, parse(buffer));
return val;

instead of

return parse(read_data(open_file(path)));

Emil


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