Topic: Exception handling and gotos


Author: fjh@munta.cs.mu.OZ.AU (Fergus Henderson)
Date: 1995/06/04
Raw View
mrice@quip.eecs.umich.edu (Michael Rice) writes:

>Section 15 of the proposed standard says:
>
>A goto ... statement can be used to transfer control out of a try-block or
>handler, but not into one.
[...]
>But what if you are already inside the try-block or handler?  Such as this:
>
>main()
>{
>        try { /* some statements */ }
>        catch(...)
>        {
>yyy:    ;  // some statements
>        goto yyy;
>        }
>        return 0;
>}

I'm sure the intent is that code like that should be legal.

--
Fergus Henderson
fjh@cs.mu.oz.au
http://www.cs.mu.oz.au/~fjh





Author: mrice@quip.eecs.umich.edu (Michael Rice)
Date: 1995/05/24
Raw View
Section 15 of the proposed standard says:

A goto ... statement can be used to transfer control out of a try-block or
handler, but not into one.

So this would be illegal:

main()
{
        try { /* some statements */ }
        catch(...)
        {
yyy:    ; // some statements
        }
        goto yyy;
        return 0;
}

But what if you are already inside the try-block or handler?  Such as this:

main()
{
        try { /* some statements */ }
        catch(...)
        {
yyy:    ;  // some statements
        goto yyy;
        }
        return 0;
}

Is this considered transferring control into the handler?  Comments?