Martin Liddle wrote:
In article <3DFDCDE7.9776FB4A@yahoo.com>, CBFalconer <cbfalconer@yahoo.com> writes
Martin Liddle wrote:
... snip ...
Thanks, that works fine. I am now starting to make some significant progress. One quirk I came across was that the following program fails to compile with
ml4.p:5: constant out of range
Program ml4; Var Magic:Integer;
begin Magic:=Ord('A')-Ord('a'); end.
The fix is trivial but it used to compile under gpc and has previously worked with two other Pascal compilers.
Am I missing something? How can you 'fix' such a failure?
The fix to my program.
Magic:=Ord('a')-Ord('A');
works fine.
Hoo-hah - that is significant for Frank, I suspect. It should point to the actual failing quite uniquely. It probably won't be in the ord parsing code. I find that: PROGRAM uicheck(input, output); TYPE unsigned = 0 .. maxint; VAR a, b : unsigned; delta : integer; BEGIN a := 10; b := 20; delta := a - b; writeln(delta); delta := b - a; writeln(delta); writeln(a - b : 12, b - a : 12); (* this gives evil results and warns, but is legal *) writeln(ord(a) - ord(b) : 12, ord(b) - ord(a) : 12); (* This seems to pass - ord has no effect warnings *) delta := ord(b) - ord(a); if delta <> 10 THEN writeln('fails'); delta := ord(a) - ord(b); IF delta <> -10 THEN writeln('fails'); END. -- Chuck F (cbfalconer@yahoo.com) (cbfalconer@worldnet.att.net) Available for consulting/temporary embedded and systems. <http://cbfalconer.home.att.net> USE worldnet address!