Loop iterator - example.txt

Bruno Medeiros brunodomedeirosATgmail at SPAM.com
Wed May 3 08:36:23 PDT 2006


Chris Miller wrote:
> 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();
> }

Actually, based on some previous notion that I don't where I got it 
from, and from Derek's comments, I thought /goto/ (in both D and C) 
could jump anywhere in the code, even across functions :o I've only 
found out now that that is not the case, and that was the most of the 
idea of my restriction.


-- 
Bruno Medeiros - CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D



More information about the Digitalmars-d mailing list