[fpc-pascal] Any chance to add the TStringBuilder to FCL?

Dmitry Boyarintsev skalogryz.lists at gmail.com
Sat Apr 16 19:39:52 CEST 2016


On Sat, Apr 16, 2016 at 2:28 PM, J├╝rgen Hestermann <
juergen.hestermann at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20160416/ac2b8171/attachment.html>


More information about the fpc-pascal mailing list