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

2016-04-19 Thread Bart
On 4/18/16, Luca Olivetti wrote: > Wait, doesn't that evaluate to > > for i:=0 to -1 > > > at least if count is a signed integer? No, not if i is unsigned (and range-checking is off). Bart ___ fpc-pascal maillist -

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

2016-04-18 Thread Luca Olivetti
El 18/04/16 a les 09:53, Marco van de Voort ha escrit: In our previous episode, J?rgen Hestermann said: > in loops. (it is that way in M2 btw, where the basetype is unsigned. Not > happy with that) I don't know what you mean. A For-loop has it's limits anyway. Limits like in for i:=0 to

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

2016-04-18 Thread Jürgen Hestermann
Am 2016-04-18 um 11:33 schrieb Sven Barth: Am 18.04.2016 07:58 schrieb "Jürgen Hestermann" >: > And why was a directive implemented to use 0-based indices > even for strings but none for 1-based indices in dynamic arrays? > IMO the

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

2016-04-18 Thread Jürgen Hestermann
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 $, so you need to guard this with a if count>0 then. Well, for 1-based arrays it

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

2016-04-18 Thread Sven Barth
Am 18.04.2016 07:58 schrieb "Jürgen Hestermann" : > And why was a directive implemented to use 0-based indices > even for strings but none for 1-based indices in dynamic arrays? > IMO the latter would be much more desired. The usual reason: Delphi compatibility. If

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

2016-04-18 Thread Marco van de Voort
In our previous episode, J?rgen Hestermann said: > > in loops. (it is that way in M2 btw, where the basetype is unsigned. Not > > happy with that) > > I don't know what you mean. > A For-loop has it's limits anyway. Limits like in for i:=0 to someexpression.count-1 are evaluated as

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

2016-04-17 Thread Jürgen Hestermann
Am 2016-04-16 um 19:39 schrieb Dmitry Boyarintsev: > 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;

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

2016-04-16 Thread Dmitry Boyarintsev
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

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

2016-04-16 Thread Jürgen Hestermann
Am 2016-04-16 um 18:36 schrieb Marco van de Voort: >> Yes, but I could store indices in DWORD if they would be 1-based >> and would not risk an exception if the index is "not valid" (which >> would be 0 in this case while it's -1 for 0-based indices). > You would have to check everywhere before

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

2016-04-16 Thread Marco van de Voort
In our previous episode, J?rgen Hestermann said: > > > while with 0-based indices high() may give -1. > > > > Indices in Pascal are always signed. > > > > > Yes, but I could store indices in DWORD if they would be 1-based > and would not risk an exception if the index is "not valid" (which > would

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

2016-04-16 Thread Jürgen Hestermann
Am 2016-04-15 um 20:35 schrieb Sven Barth: Am 15.04.2016 18:37 schrieb "Jürgen Hestermann" >: > > Another advantage of having 1-based indeces in dyn. arrays > would be that you could store indeces in unsigned integers > while with

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

2016-04-15 Thread leledumbo
> We already have zero based strings in 3.0.0 if {$ZeroBasedStrings On} is > used (it's a local switch). It works with Ansi-, Wide- and > UnicodeString, but not with ShortString. *shocked* so many hidden treasures in FPC... -- View this message in context:

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

2016-04-15 Thread Sven Barth
Am 15.04.2016 18:37 schrieb "Jürgen Hestermann" : > > Another advantage of having 1-based indeces in dyn. arrays > would be that you could store indeces in unsigned integers > while with 0-based indices high() may give -1. Indices in Pascal are always signed. Regards,

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

2016-04-15 Thread Dmitry Boyarintsev
On Fri, Apr 15, 2016 at 1:19 PM, Jürgen Hestermann < juergen.hesterm...@gmx.de> wrote: > > So why do we need {$ZeroBasedStrings On} at all? ;-) > The same reason as other FPC features - (some of) Delphi code compatibility. thanks, Dmitry ___

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

2016-04-15 Thread Jürgen Hestermann
Another advantage of having 1-based indeces in dyn. arrays would be that you could store indeces in unsigned integers while with 0-based indices high() may give -1. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org

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

2016-04-15 Thread Jürgen Hestermann
Am 2016-04-15 um 10:26 schrieb Graeme Geldenhuys: >> Is there also a switch >> {$OneBasedDynArrays On} ? >> No more confusion about first and last element index. > You really should be using low() and high() instead. ;-) So why do we need {$ZeroBasedStrings On} at all? ;-) Of course, when you

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

2016-04-15 Thread Sven Barth
Am 15.04.2016 10:47 schrieb "Graeme Geldenhuys" < mailingli...@geldenhuys.co.uk>: > > Is there also a switch > > {$OneBasedDynArrays On} ? > > No more confusion about first and last element index. > > You really should be using low() and high() instead. ;-) Definitely (and they also work for

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

2016-04-15 Thread Graeme Geldenhuys
On 2016-04-15 07:24, Jürgen Hestermann wrote: > Though I will not use it. Neither would I. I don't see the need for it. > Is there also a switch > {$OneBasedDynArrays On} ? > No more confusion about first and last element index. You really should be using low() and high() instead. ;-)

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

2016-04-15 Thread Michael Van Canneyt
On Fri, 15 Apr 2016, Sven Barth wrote: Am 14.04.2016 23:22 schrieb "Graeme Geldenhuys" < mailingli...@geldenhuys.co.uk>: On 2016-04-14 19:27, Sven Barth wrote: We already have zero based strings in 3.0.0 if {$ZeroBasedStrings On} is used (it's a local switch). Wow, learnt something new

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

2016-04-14 Thread Jürgen Hestermann
Am 2016-04-14 um 23:22 schrieb Graeme Geldenhuys: > On 2016-04-14 19:27, Sven Barth wrote: >> We already have zero based strings in 3.0.0 if {$ZeroBasedStrings On} is >> used (it's a local switch). > Wow, learnt something new again. Never new that existed. Me too. Though I will not use it. Is

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

2016-04-14 Thread Sven Barth
Am 14.04.2016 23:22 schrieb "Graeme Geldenhuys" < mailingli...@geldenhuys.co.uk>: > > On 2016-04-14 19:27, Sven Barth wrote: > > We already have zero based strings in 3.0.0 if {$ZeroBasedStrings On} is > > used (it's a local switch). > > Wow, learnt something new again. Never new that existed. I

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

2016-04-14 Thread Graeme Geldenhuys
On 2016-04-14 19:27, Sven Barth wrote: > We already have zero based strings in 3.0.0 if {$ZeroBasedStrings On} is > used (it's a local switch). Wow, learnt something new again. Never new that existed. I really should read the “what’s new” document. Regards, Graeme

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

2016-04-14 Thread Sven Barth
On 14.04.2016 19:36, leledumbo wrote: >> Is there any chance to add a class like Delphi's TStringBuilder to FCL? It > would be very useful to port Delphi code libraries to Free Pascal. > > That exists mainly to overcome the read-only, 0-based string implementation > limitations in Delphi NextGen,

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

2016-04-14 Thread leledumbo
> Is there any chance to add a class like Delphi's TStringBuilder to FCL? It would be very useful to port Delphi code libraries to Free Pascal. That exists mainly to overcome the read-only, 0-based string implementation limitations in Delphi NextGen, doesn't it? Porting will still require 0-based

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

2016-04-14 Thread silvioprog
Hello, Is there any chance to add a class like Delphi's TStringBuilder to FCL? It would be very useful to port Delphi code libraries to Free Pascal. Thank you! -- Silvio Clécio