[fpc-devel]array dimensions bug?
Peter Vreman
peter at freepascal.org
Tue Nov 6 14:30:11 CET 2001
> > 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.
open arrays start always with 0. But using low() and high() is the recommended way
> > 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"??
No, this is also support by delphi/tp7. It is passed as 'array[0..0] of integer'
More information about the fpc-devel
mailing list