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 1-ba

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 de

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" mailto:juergen.hesterm...@gmx.de>>: > > 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

Re: [fpc-pascal] FPC 3 regression: cannot use TStringList for UTF-8 data any more?

2016-04-16 Thread Jonas Maebe
Mattias Gaertner wrote: That's correct. String literals in a codepage other than system are stored as UTF-16 in the binary and converted on assign. The conversion happens at runtime, so the string codepage is decided at runtime. That's correct if the assignment is to a variable/parameter that h

Re: [fpc-pascal] FPC 3 regression: cannot use TStringList for UTF-8 data any more?

2016-04-16 Thread Mattias Gaertner
On Fri, 15 Apr 2016 10:43:55 +0200 Michael Schnell wrote: >[...] > Do you suggest that the codepage of the sourcecode is preserved by the > compiler when creating the string constant in object code ? It depends. There are two codepages. The real one and the one you tell the compiler. If you te

Re: [fpc-pascal] FPC 3 regression: cannot use TStringList for UTF-8 data any more?

2016-04-16 Thread Mattias Gaertner
On Fri, 15 Apr 2016 10:19:06 +0200 Michael Schnell wrote: > On 04/15/2016 08:35 AM, Michael Van Canneyt wrote: > > > > For string constants there are slightly different rules. There the > > result depends on the {$codepage} directive of the source file. > > Hmmm. > > If not setting $codepage I

Re: [fpc-pascal] FPC 3 regression: cannot use TStringList for UTF-8 data any more?

2016-04-16 Thread Michael Schnell
On 04/15/2016 08:35 AM, Michael Van Canneyt wrote: For string constants there are slightly different rules. There the result depends on the {$codepage} directive of the source file. Hmmm. If not setting $codepage Ifor a constant string I get StringCodePage = 0, If setting {$codepage UTF8} f

Re: [fpc-pascal] FPC 3 regression: cannot use TStringList for UTF-8 data any more?

2016-04-16 Thread Michael Schnell
On 04/15/2016 10:32 AM, Graeme Geldenhuys wrote: If you as a programmer knows the unit is saved in UTF-8 encoding, then add {$codepage utf8} to the top of the unit. That tells the compiler how to interpret string constants in that unit (without the need for any guessing). I did some test with