[fpc-devel]array dimensions bug?

Jonas Maebe jonas at zeus.rug.ac.be
Tue Nov 6 14:08:39 CET 2001


On dinsdag, november 6, 2001, at 01:54 , Aleksey V. Vaneev wrote:

> Here's some strange behaviour... it outputs
>
> 0   0
> 0   0
> 0   50
>
> In fact this is GOOD if base index of parametrised arrays is always
> 0, but in my previous "array of question" you've said I must use
> low() and high(). So, what to assume?

Always use low and high. They are evaluated at compile time if possible, 
so you will not lose any speed and you will always get the correct 
results.

> procedure aaa(var a: array of Integer);
> begin
> writeln(low(a):10,high(a):10);
> end;
>
> var
>         aa: array [0..50] of Integer;
>
> begin
> aaa(aa[0]);

Shouldn't this be rejected? Passing an integer as an "array of integer"??


Jonas





More information about the fpc-devel mailing list