|
Boost : |
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2023-12-06 15:45:51
On 12/6/23 17:25, Andrey Semashev wrote:
> On 12/6/23 14:58, Julien Blanc wrote:
>> Le 2023-12-05 16:54, Andrey Semashev via Boost a écrit :
>>> On 12/5/23 17:34, Julien Blanc via Boost wrote:
>>>>
>>> Regarding why scope_fail doesn't enforce noexcept-ness of the action, it
>>> is because the "failure" may be indicated by other means than an
>>> exception. The library explicitly supports error codes as an alternative.
>>>
>>> In general, I think that marking scope guards' destructors noexcept is
>>> pointless. If the action throws while there is another exception in
>>> flight, your program will terminate either way. If the action throws
>>> while there is no other exception then why should the scope guard
>>> terminate the program? Throwing in this case might as well be the
>>> intended behavior. Because if it isn't intended then it is the user who
>>> must communicate this by marking his operator() as noexcept.
>>
>> I think there's a misunderstanding here. My point was exactly about
>> asserting is_nothrow_invocable for the scope_fail constructor argument,
>> not for its destructor.
>
> It doesn't matter where the assert is. I disagree with the requirement
> itself.
To clarify, I was also talking about the requirement of the action being
is_nothrow_invocable. Scope guards' destructor noexcept markup is
directly related to the action's operator() noexcept markup.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk