[fpc-devel] Extended($FFFFFFFFFFFFFFFF) = -1?

Jonas Maebe jonas.maebe at elis.ugent.be
Fri Feb 28 20:39:28 CET 2014

On 28 Feb 2014, at 20:21, Ewald wrote:

> 	WriteLn(Extended(QWord($FFFFFFFFFFFFFFFF)));	//1
> 	WriteLn(Extended($FFFFFFFFFFFFFFFF));			//2
> 	WriteLn(Extended(Longword($FFFFFFFF)));			//3
> 	WriteLn(Extended($FFFFFFFF));					//4
> End.
> =======
> Here I would expect four rather large values on standard output. The thing is that the second test gives me -1. I suspect this is due to the compiler interpreting the constant as an Int64; this is confirmed by the first test.


> Since I was curious as to the intended-ness of this behaviour I wrote the second set of tests which show me that this is not true for longwords: both 3 & 4 give the same result. This lead me to the conclusion that this is a bug. Shall I file it?

All hexadecimal constants are (conceptually) parsed as int64, so this is by design. int64($00000000ffffffff) is not -1.


More information about the fpc-devel mailing list