[fpc-pascal] High() and Low() for empty dynamic arrays

Florian Klaempfl florian at freepascal.org
Sat Feb 8 17:05:46 CET 2014


Am 08.02.2014 16:56, schrieb Jürgen Hestermann:
>
> because otherwise I would get an error in case the length is 0
> because Low() and High() both give back 0.
> The result of both functions is the same as if the array had exact one
> element.

Here:

var MyArray : array of longint;

begin
   writeln(low(MyArray));
   writeln(high(MyArray));
end.

prints

0
-1

Unfortunatly you posted not a complete example which shows the behaviour 
but only uncompilable code snippts. Post always complete examples when 
discussing strange behaviour.



More information about the fpc-pascal mailing list