Behaviour of goto into catch blocks.
Iain Buclaw
ibuclaw at ubuntu.com
Sat Sep 4 20:24:18 PDT 2010
When it comes to using goto in D, the behaviour seems to be that you cannot enter a try block, and neither can you enter or exit from a
finally block.
What about catch blocks? It seems that there is no restrictions imposed on them, meaning that the following is legal.
void main()
{
goto in_catch;
try
{
throw new Exception("msg");
}
catch (Exception e)
{
in_catch:
throw e;
}
}
As strongly as I feel that goto into catch blocks shouldn't be allowed, is this the intended behaviour of the language? If so, why?
More information about the Digitalmars-d
mailing list