[M3devel] subrange value not constant?

Martin Bishop martinbishop at bellsouth.net
Tue May 19 23:32:24 CEST 2009


I've written this procedure (an implementation of counting sort):

PROCEDURE Sort(VAR a: ARRAY OF INTEGER; min, max: INTEGER) =
  VAR count := ARRAY [min..max] OF INTEGER {0, ..};
      z := 0;
  BEGIN
    FOR i := FIRST(a) TO LAST(a) DO
      count[i - min] := count[i - min] + 1;
    END;
    FOR i := min TO max DO
      WHILE count[i - min] > 0 DO
        a[z] := i;
        INC(z);
        count[i - min] := count[i - min] - 1;
      END;
    END;
  END Sort;

However, when I try to compile I get:

"../Counting.m3", line 8: subrange lower bound is not constant
"../Counting.m3", line 8: subrange upper bound is not constant

Line 8 is:

 VAR count := ARRAY [min..max] OF INTEGER {0, ..};

I don't see what's wrong?




More information about the M3devel mailing list