[fpc-devel] Extended($FFFFFFFFFFFFFFFF) = -1?
Hans-Peter Diettrich
DrDiettrich1 at aol.com
Sat Mar 1 03:06:34 CET 2014
Ewald schrieb:
> On 28 Feb 2014, at 20:39, Jonas Maebe wrote:
>> All hexadecimal constants are (conceptually) parsed as int64, so
>> this is by design. int64($00000000ffffffff) is not -1.
> By the way, what do you do when you want to port fpc to a one's
> comlement machine (if they still exist)?
Numerical constants, where the sign matters, should only be encoded in
decimal. The other formats (hex,oct,bin...) are intended for use with
binary values, where the bit pattern is important. Then the code
compiles correctly on any kind of machine.
Assumptions about type sizes and encodings can make *application* code
unportable. E.g. the Extended type doesn't have a guaranteed size and
binary representation, IIRC it's equivalent to Double on x64.
DoDi
More information about the fpc-devel
mailing list