On Sat, Apr 16, 2016 at 2:28 PM, Jürgen Hestermann < juergen.hesterm...@gmx.de> wrote:
> I don't know what you mean. > A For-loop has it's limits anyway. > And when decrementing 'manually' I would stop if INDEX=0. > For 0-based arrays I would stop if INDEX=-1? > What would be different? > For 1-based arrays I would never get an index<0 > because it stops at zero. The problem is with using "unsigned" as an index (rather than zero- vs one- based arrays) Take a while loop as an example, where index can change multiple times. Current solution: while i>=0 do if cond then dec(i); dec(i); end; Unsigned index solution while i>=0 do if cond then if i>0 then dec(i); if i>0 then dec(i); end; Without these checks, unsigned integer would loop over to $FFFFFFFF and will continue. thanks, Dmitry
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal