[comp.lang.modula2] Why are my loops so awkward?

borchert@MATHEMATIK.UNI-ULM.DE (Andreas Borchert) (06/27/90)

Richard Carter writes:

>   FOR i := 1 TO Length(s) DO
>     process(s[i-1]);
>     END;
>
> If Length(s) = 0, the loop never executes.  The only probelm I can
> see is that some compilers might not like the s[i-1] bit.  I seem
> to recall using a M2 compiler that wouldn't pass a computed index
> as a parameter in a procedure call (though, it's been so long, I
> coulldn't tell you which one).

The M2 compiler you cannot remember is probably the Lilith Modula-2 compiler.
In this case the implementation restriction applies for VAR-parameters only.
Lilith is word-addressed and thus not able to pass the address
of an element of a character array.

Andreas Borchert
--
borchert@mathematik.uni-ulm.de
borchert@dulruu51.bitnet