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

Hans-Peter Diettrich DrDiettrich1 at aol.com
Mon Mar 3 21:44:03 CET 2014

Ewald schrieb:
> On 03 Mar 2014, at 12:49, Hans-Peter Diettrich wrote:

>> How (which data type) does *your* parser store untyped numerical
>> constants?
> Roughly like this (syntax may be a bit awry, but you get the point):
> TIntegerNumber = Record Case SignedNess: TSignedNess of snPositive:
> UValue: QWord; snNegative:  SValue: Int64; End;
> The parser detects wether there is a `-` in front of the constant and
> stores the right sign in the SignedNess field.

A parser doesn't work like that - too many possible cases with unary 
minus. If you need an datatype for integers with more bits than provided 
by the compiler, you must roll your own datatype.

> Alright, let me rephrase my demands: - I want to store the value
> 18446744073709551615 in any kind of variable without loss of
> precision.

See above.


More information about the fpc-devel mailing list