On 6 Apr 2006 at 20:15, Bart van den Broek wrote:
[...]
When I run this program in Delphi v7.1 (7.0 + patch)
program Project1;
{$APPTYPE CONSOLE}
procedure RunTest; var n : Integer; m : Integer; begin n := 42; m := 43; Writeln(ByteBool(n) = ByteBool(m)); Writeln(ByteBool(n) = ByteBool(42)); Writeln(ByteBool(n) = True); Writeln(Ord(ByteBool(True)));
Writeln(WordBool(n) = WordBool(m)); Writeln(WordBool(n) = WordBool(42)); Writeln(WordBool(n) = True); Writeln(Ord(WordBool(True)));
Writeln(LongBool(n) = LongBool(m)); Writeln(LongBool(n) = LongBool(42)); Writeln(LongBool(n) = True); Writeln(Ord(LongBool(True)));
Writeln(Pred(Boolean(False))); Writeln(Pred(ByteBool(False))); Writeln(Pred(WordBool(False))); Writeln(Pred(LongBool(False))); end;
begin RunTest; end.
[...]
1. Delphi 3.0 and Delphi 4.0: TRUE FALSE TRUE 255 ----------------------- TRUE FALSE TRUE 65535 ----------------------- TRUE FALSE TRUE -1 ----------------------- TRUE TRUE TRUE TRUE
Delphi 7: TRUE TRUE TRUE 255 ----------------------- TRUE TRUE TRUE 65535 ----------------------- TRUE TRUE TRUE -1 ----------------------- Runtime error 216 at 00402BC4 (program GPFs here)
FPC (2.0.0): TRUE TRUE TRUE 1 ----------------------- TRUE TRUE TRUE 1 ----------------------- FALSE TRUE TRUE 1 ----------------------- TRUE TRUE TRUE TRUE
But gives "Warning: range check error while evaluating constants" on these two lines at compile time: Writeln(Pred(WordBool(False))); Writeln(Pred(LongBool(False)));
Best regards, The Chief -------- Prof. Abimbola A. Olowofoyeku (The African Chief) web: http://www.greatchief.plus.com/