goto

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Feb 5 21:30:20 PST 2009


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



More information about the Digitalmars-d mailing list