Am 2014-02-08 17:05, schrieb Florian Klaempfl: > Here: > var MyArray : array of longint; > begin > writeln(low(MyArray)); > writeln(high(MyArray)); > end. > prints > 0 > -1
Hmm. I was under the impression that both give back zero. But you are right. A closer look showed that the error I got for arrays of zero length came from the fact that I used a Cardinal type variable for the for-loop: ------------------------------------------- var i : Cardinal; for i := Low(MyArray) to High(MyArray) do ... ------------------------------------------- which raises an exception when the array is empty but works ok in all other cases. Thanks for pointing me to my fault. > Unfortunatly you posted not a complete example which shows the behaviour but only uncompilable code snippts. > Post always complete examples when discussing strange behaviour. You mean I should post thousands of code lines? _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal