goto

Chris R Miller lordsauronthegreat at gmail.com
Fri Feb 6 17:33:51 PST 2009


Bill Baxter wrote:
> On Fri, Feb 6, 2009 at 2:30 PM, Andrei Alexandrescu
> <SeeWebsiteForEmail at erdani.org>  wrote:
>> Walter Bright wrote:
>>> double euclideanDistance(Range)(Range a, Range b, double limit)
>>> {
>>>     limit *= limit;
>>>     double result = 0;
>>>     for (; 1; a.next, b.next)
>>>     {
>>>         if (a.empty)
>>>         {
>>>            enforce(b.empty);
>>>            break;
>>>         }
>>>         enforce(!b.empty);
>>>         auto t = a.head - b.head;
>>>         result += t * t;
>>>         if (result>= limit) break;
>>>     }
>>>     return sqrt(result);
>>> }
>> Gotta give it to The Man!
>>
>> So after all I couldn't find a good use for goto.
>
> Meh.  I dislike seeing things like for(; 1; ) or while(true) in a loop
> (unless it's something like a top level message processing loop or
> such).  At least in your goto version I know from a glance at the
> for() part  that at most we're going to iterate till the thing is
> empty.

Wherever did the foreach(auto foo in bar) feature request go?  Or did 
that conflict with existing syntax?



More information about the Digitalmars-d mailing list