[cxx-abi-dev] How to detect a forced unwind in a catch block?

John McCall rjmccall at apple.com
Tue Sep 6 18:56:24 UTC 2016


> On Sep 6, 2016, at 11:50 AM, Thiago Macieira <thiago at kde.org> wrote:
> Em terça-feira, 6 de setembro de 2016, às 11:38:43 PDT, John McCall escreveu:
>> This would be inappropriate; the appropriate solution would be to ask the
>> committee for a new function in namespace std that could be implemented
>> with abi::__forced_unwind.  I believe that's the chief purpose of that
>> function, to allow that sort of functionality to be implemented in the
>> future.
>> 
>> If std::current_exception works, of course, all the better.
> 
> I will post to std-discussion and see if there's a consensus. I'm not sure 
> there can be because this is outside of the C++ language: there's no such 
> thing as forced unwinds in the standard.

Hmm.  I think this used to not be true; there were library features (e.g. longjmp)
that were allowed, but not required, to be implemented by unwinding the stack.
But now it seems that these places have all been changed to specify undefined
behavior if they would bypass any non-trivial destructors.

That said, I think force-unwinding is a feature in all the major EH implementations.

John.


More information about the cxx-abi-dev mailing list