goto

Don nospam at nospam.com
Fri Feb 6 00:04:44 PST 2009


Andrei Alexandrescu 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.
> 
> 
> Andrei

The irony is that's Walter's the biggest goto advocate I know, other 
than Linus Torvalds.




More information about the Digitalmars-d mailing list