[fpc-pascal] Int64 is not an ordinal...

Michael Van Canneyt michael at freepascal.org
Sat Jan 5 18:15:38 CET 2013



On Sat, 5 Jan 2013, Bart wrote:

> Hi,
>
> I tried using an Int64 as a loop variable in a for loop.
> The compiler complained that it was not an ordinal type.
>
> This struck me as odd.
> The docs indeed say Int64 and Word are not true ordinal types, but
> they seem to fit the definition given in the same document:
>
> 1. Ordinal types are countable and ordered, i.e. it is, in principle,
> possible to start counting them one by one, in a specified order. This
> property allows the operation of functions as Inc, Ord,Dec on ordinal
> types to be defined.
> 2. Ordinal values have a smallest possible value. Trying to apply the
> Pred function on the
> smallest possible value will generate a range check error if range
> checking is enabled.
> 3. Ordinal values have a largest possible value. Trying to apply the
> Succ function on the largest possible value will generate a range
> check error if range checking is enabled.
>
> So, why aren't Int64 and QWord "true" ordinals?

Because they don't fit in 32 bits.

Michael.



More information about the fpc-pascal mailing list