Loop iterator - example.txt

Chris Miller chris at dprogramming.com
Mon May 1 03:44:34 PDT 2006


On Mon, 01 May 2006 05:36:56 -0400, Bruno Medeiros  
<brunodomedeirosATgmail at SPAM.com> wrote:

> Hum, now that you mention it, what if goto could only jump to labels  
> that are lexically visible in the current scope, using the same rules as  
>   variables. Seems to me it would make goto more safe, but is such  
> behavior acceptable? I mean, is there a reasonable use scenario for goto  
> that requires a cross-scope jump? (I wonder if any of the cases  
> presented by Walter would require such thing)
>

C# has a restriction similar to this and it's pretty annoying.

if(something)
    goto mylabel;   // error, mylabel not in scope.
stuff();
if(somethingelse)
{
    mylabel:
    morestuff();
}



More information about the Digitalmars-d mailing list