|
Boost : |
Subject: Re: [boost] The noexcept Specifier & Block
From: Gabriel Dos Reis (gdr_at_[hidden])
Date: 2009-04-17 11:04:46
On Fri, Apr 17, 2009 at 9:30 AM, Stefan Seefeld <seefeld_at_[hidden]> wrote:
> Alexander Terekhov wrote:
>>
>> Gabriel Dos Reis wrote:
>>
>>>
>>> On Thu, Apr 16, 2009 at 7:11 PM, Alexander Terekhov <terekhov_at_[hidden]>
>>> wrote:
>>>
>>>>
>>>> Scott McMurray wrote:
>>>> [...]
>>>>
>>>>>
>>>>> I don't see how you're going to get the "at throw point" you're asking
>>>>> for.
>>>>>
>>>>
>>>> Two-phase EH.
>>>>
>>>
>>> An implementation strategy used by some compilers. It is not
>>> something required by C++. It is mysterious why some popular
>>> compilers insist on using that strategy when they know they are
>>> dealing with C++ applications.
>>>
>>
>> Because that strategy allows to not unwind the stack for unexpected
>> exceptions.
>>
>
> Can you elaborate on that a little ? 15.5.2/1 says
>
> "If a function with an exception-specification throws an exception that is
> not listed in the exception-specification, the function void unexpected();
> is called (18.6.2) immediately after completing the stack unwinding for the
> former function."
>
> So, stack unwinding certainly has to happen, from the call site down to the
> point where the exception is not allowed to pass.
>
> Am I missing something ?
Lisp has the notion of 'restartable exception' (condition in Lisp speak),
so the general facility was designed to accomodate for that.
However, in practice most C++ programs don't need that
expensive 2-phase search of handlers.
Others argue that some programs may want the debugger
to drop them at the point where an exception was thrown, but
again it is not clear that that expensive 2-phase search is actually used.
In any case, it is an implementation detail cost that is uniformly
imposed on C++ programs (especially the vast majority that
do not use it).
-- Gaby
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk