[comp.lang.modula2] Survey: Changing the Control Variable in a FOR

pattis@june.cs.washington.edu (Richard Pattis) (02/13/89)

I'd like to conduct a brief survey on the net.  Does your M-2 compiler
allow the following code fragment?

  FOR I:=1 TO 10 DO
    I:= 1
  END

  The M-2 report says, "Its [the control variable] value should not be changed
by the statement sequence." (page 158, 3rd corrected edition)  The Logitech
VAX/VMS compiler that I have access to allows this code fragment. Is this
statement aimed at the programmer or the compiler writer? Are there any other
obvious examples of properties that could be statically checked by the
compiler, but aren't required by the Modula-2 report?  Thanks for your time.

Rich Pattis

troy@zem.uchicago.edu (Troy Zerr) (02/14/89)

In article <7257@june.cs.washington.edu> pattis@june.cs.washington.edu (Rich
Pattis) writes:
>Does your M-2 compiler allow the following code fragment?
>  FOR I:=1 TO 10 DO
>    I:= 1
>  END
JPI Modula-2 for the IBM compiles it without complaint.
The loop does not terminate when executed.
         -------------------------------------------------
A question for other JPI users:
Does your GRAPH.MOD library module work correctly on a Hercules graphics
card?  I have a Zenith 449 EGA video card which claims to emulate a Herc.
When I tried to modify an EGA program to use Hercules mode, I got garbage
on the screen.  Is this a fault in my program (I don't think so),
a fault in Zenith's emulation, or a fault in the library module?
I have version 1.5, s/n 5003.


Thanks.

Troy Zerr