Subject: Re: [boost] Noexcept
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2017-06-12 17:57:24
On Mon, Jun 12, 2017 at 1:58 AM, Andrzej Krzemienski via Boost <
> 2017-06-12 10:22 GMT+02:00 Emil Dotchevski via Boost <
> > The lively debates during the Outcome review show that there is a great
> > deal of interest in solving the problem of error handling in environments
> > where C++ exception handling is unavailable.
> > Noexcept is a new C++11 library that implements a different approach to
> > solving the same problem. Any feedback is welcome.
> > https://zajo.github.io/boost-noexcept/
> > Emil
> Thanks for sharing. The library looks interesting.
> It is my understanding that the caller can decide whether they want to
> catch exceptions (with try_), or let the exception pass: in this case you
> read the value returned from a function directly, which may result in
> obtaining a "default value" of the returned type. Right?
Yes, if you do not use exceptions there must be a special return value that
signals an error, there is no way around that.
So, what you are describing is a failure detected in a function which
doesn't (can't?) handle it. Usually (e.g. if the function returns
optional<>) it looks like this:
if( auto r=f() )
//good, use r.result();
//error! cleanup and return