Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2011-12

range check error while evaluating constant (number literals larger than$7fffffffffffffff)

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bernd
var
  x : QWord;
begin
  x := $ffffffffffffffff;
  writeln(IntToHex(x, 16));
end.

this happens at compile time when trying to evaluate the literal $ffffffffffffffff

testus.lpr(16,8) Warning: range check error while evaluating constants

But it still seems to evaluate it correctly and the variable will have the correct value, so its not a show stopper for me, just an annoying warning. It seems it starts complaining as soon as it exceeds the range of a signed 64 bit.

I am using the 2_6 branch on linux/i386

Bernd

Reply by email

Jonas Maebe
to Bernd
Bernd wrote 7 lines
var x : QWord; begin x := $ffffffffffffffff; writeln(IntToHex(x, 16)); end.

All constants > $ffffffff are always parsed as int64. You have to explicitly typecast them to qword() if you want the compiler to treat them that way.

Jonas

Reply by email