[net.micro.mac] IMPORTANT: MacPascal

sdh@alice.UUCP (Steve Hawley) (01/26/85)

Attention world!

There is a major bug in MacPascal.

According to the Pascal Reference manual the foolowing type 
declarations are equivalent:

mat : array[1..2] of array[1..2] of integer;

mat1 : array[1..2,1..2] of integer;

They are only equivalent in theory.

In practice the first structure (which I prefer as it lends greater 
readability to the code) is a valid statement, but any results using
such a matrix are incorrect.

Consider this program

Program testmat;

type foomat = array[1..4] od array[1..4] of Integer;

var foobar : foomat;
    x,y : Integer {Indexes}

begin
  for x := 1 to 4 do
     begin
        for y := 1 to 4 do
            begin
              foobar[x][y] := x;
              write(foobar[x][y] : 1)
            end;
        writeln
     end;
   for x := 1 to 4 for do
      begin
         for y := 1 to 4 do
            write(foobar[x][y] : 1);
         writeln
      end
end.

The EXPECTED ouput should be:
1111
2222
3333
4444
1111
2222
3333
4444

The output is in fact:
1111
2222
3333
4444
1234
2344
3444
4444

Try to pin that bug down if the natrix is have messy 3D rotation and
projection formulae run through it!

I sincerely hope Apple gets this one fixed, or at least releases
a compiler based Pascal to save memory and decrease execution time.

Steve Hawley
decvax!ucbvax!research!alice!sdh