[basic-improvements] try/finally support for c/c++

Richard Henderson rth@redhat.com
Wed Nov 6 14:00:00 GMT 2002


On Wed, Nov 06, 2002 at 07:22:33PM +0000, Joseph S. Myers wrote:
> I don't think it's yet been stated whether you may jump into the finally 
> block from outside, or what happens after the execution of the finally 
> block if you do.

No, you cannot jump into the finally block.  There is no well-defined
"next" block for us to proceed to after executing the finally block.
I wouldn't even want to consider the consequences of a goto from the
try block into its finally block.

> > + If a try block was exited by @code{return}, then the function returns
> > + after finishing the finally block (unless inside other try block).  If
> > + a try block is exited normally, then execution continues after the end
> > + of the finally block.  If a try block is exited through an exception
> > + being thrown (or forced unwinding), then after finally block exits,
> > + the exception is resumed or forced unwinding continues.
> 
> This paragraph fails to mention what happens if the try block is exited by 
> a jump (goto, break or continue).

Indeed, I think this paragraph should follow C++ in enumerating the
ways in which you *may* leave a block, rather than enumerating the
ways in which you may not leave a block.



r~



More information about the Gcc-patches mailing list