[fpc-devel] Overflow checks differ between constants and variables
lazarus at mfriebe.de
Mon Apr 21 08:29:10 CEST 2014
In the below example range and overflow checks are off.
The "a-b" line gives the result "2". (As expected after the overflow)
Doing the same operation with constants, does not compile, due to an
overflow error (despite $Q-). Why?
var a, b: qword;
a := 1;
b := qword($ffffffffffffffff);
writeln( qword(1) - qword($ffffffffffffffff) ); //
project1.lpr(7,21) Error: Overflow in arithmetic operation
More information about the fpc-devel