Wacky Programming Tales

Roy Smith roy at popmail.med.nyu.edu
Wed Aug 18 19:06:30 CEST 1999


Patrick Bogaart <bogw at geo.vu.nl> wrote:
> >         i = 0;
> >         while( i < max_index ) {
> >                 /* some copying or update (not modifying i) goes here */
> >                 i = i + 1;
> >         }

> 
>         i = 0;
>         label_1:;
>         /* some use of i */
>         i = i + 1;
>         if (i==max_index) goto label_2;
>         goto label_1;
>         label_2:;
> 
> <wink>

To get the correct behavior for values of max_index less than 0, you need
to change the test from "i == max_index" to "i >= max_index", and you also
need to move the test to directly after label_1.  Other than that, it
looks like perfectly reasonable ratfor-type output (except that the labels
should start at 23001).

-- 
Roy Smith <roy at popmail.med.nyu.edu>
New York University School of Medicine





More information about the Python-list mailing list