Subject: Re: [boost] Noexcept
From: Andrzej Krzemienski (akrzemi1_at_[hidden])
Date: 2017-06-30 07:08:06
2017-06-29 19:26 GMT+02:00 Emil Dotchevski via Boost <boost_at_[hidden]>
> On Wed, Jun 28, 2017 at 11:34 PM, Andrzej Krzemienski via Boost <
> boost_at_[hidden]> wrote:
> > 2017-06-29 8:14 GMT+02:00 Emil Dotchevski via Boost <
> > >:
> > > On Wed, Jun 21, 2017 at 12:43 AM, Andrzej Krzemienski via Boost <
> > > boost_at_[hidden]> wrote:
> > >
> > > > > In error-neutral contexts, you simply return throw_() to propagate
> > any
> > > > > error from lower level functions.
> > > >
> > > > But does this not compromise exception neutrality? That you have to
> > > specify
> > > > in each function that you want to just pass the exception up?
> > >
> > > Compared to what? Is there a better option when you can't throw?
> > My observation is, if you cannot throw then exception neutrality is not
> > achievable.
> In functions that propagate errors in the return value (very common both in
> C and in -fno-exceptions C++), each caller has to take the returned error
> code, examine it, then possibly return a copy of it -- but it is also
> common to return another error, which is known as error translation (which
> is a bad idea).
> Instead, functions which can't handle the error should just propagate it to
> the caller. That is what it means to be neutral: "I don't know what this
> is, someone else please deal with it". In Noexcept neutrality can be
> expressed explicitly: you simply return throw_(), which doesn't touch the
> error object at all.
Ok, I get it now. IOW, by "neutrality" you are saying "I am not handling or
changing type of an exception unless I am sure I recognize this condition",