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

2013-01-05 Thread Michael Van Canneyt



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.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


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

2013-01-05 Thread Bart
On 1/5/13, Michael Van Canneyt  wrote:

> Because they don't fit in 32 bits.

Which (to me) raises the question: why do "true ordinal" values have
to fit in 32 bits?

Bart
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


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

2013-01-05 Thread Florian Klämpfl
Am 06.01.2013 00:34, schrieb Bart:
> On 1/5/13, Michael Van Canneyt  wrote:
> 
>> Because they don't fit in 32 bits.
> 
> Which (to me) raises the question: why do "true ordinal" values have
> to fit in 32 bits?

Because operations like array accesses require that they fit into one
register.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal