Am 2016-04-18 um 09:53 schrieb Marco van de Voort:
Limits like in

for i:=0 to someexpression.count-1

are evaluated as expression before using the result to for. If count=0 this
would become for i:=0 to $FFFFFFFF, so you need to guard this with a if
count>0 then.


Well, for 1-based arrays it would be

for i := 1 to someexpression.count

(without the annyoing -1).
In general I can make sure that somexpression.count is zero or larger
when I use it to determine an index for my array.
The same would be

for i := low(array) to high(array)

which is very common and where I would not need to use an unsigned integer.




_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to