|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2003-10-11 12:47:34
Alexander Terekhov wrote:
> Peter Dimov wrote:
> [...]
>> You can't have it both ways.
>
> Sure you can. That's "the beauty" of 2-phase EH.
Sorry, I don't see it. To search for a handler, you need stack frames. To
omit the stack frame (and make the function a candidate for inlining), you
need to prove statically that nothing performed by this function will throw.
But how can you do that in a world where everything can throw?
void h(int) throw();
void f() throw()
{
h(5); // #1: can throw stack_ovf_e
}
void g()
{
try { f(); } catch(stack_ovf_e) { /**/ }
}
If you omit f()'s stack frame, #1 will find the catch.
>> Either stack overflow et al are C++
>> exceptions and everything can throw, hence stack frames are always
>> required, or throw() specs have no cost if static analysis can prove
>> the code doesn't throw. Pick one. :-)
>
> http://groups.google.com/groups?selm=3D661874.F3A00006%40web.de
> (Subject: Re: C++ exception handling)
>
> http://groups.google.com/groups?selm=3E0C27B6.1D7EC741%40web.de
> (Subject: Re: C++ stack overflow and exception safety)
>
> (Don't miss a "#pragma unexpected_exception" embedded link)
>
> Questions?
These links clarified nothing for me.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk