[fpc-devel] copy for PChar

2012-02-19 Thread Mattias Gaertner
Hi, When I use copy on a PChar (e.g. copy(p,1,1)), it is very slow, because the compiler converts the PChar to a string. Is there already a function for PChar? Can an overloaded version of copy be added? Mattias ___ fpc-devel maillist -

Re: [fpc-devel] copy for PChar

2012-02-19 Thread Sergei Gorelkin
19.02.2012 18:38, Mattias Gaertner пишет: Hi, When I use copy on a PChar (e.g. copy(p,1,1)), it is very slow, because the compiler converts the PChar to a string. Not sure why it is allowed in the first place. If out of Delphi compatibility, maybe we should leave it enabled for {$mode delphi}

Re: [fpc-devel] copy for PChar

2012-02-19 Thread Marco van de Voort
In our previous episode, Mattias Gaertner said: When I use copy on a PChar (e.g. copy(p,1,1)), it is very slow, because the compiler converts the PChar to a string. Is there already a function for PChar? http://www.freepascal.org/docs-html/rtl/strings/strlcopy.html

Re: [fpc-devel] copy for PChar

2012-02-19 Thread Mattias Gaertner
On Sun, 19 Feb 2012 20:01:11 +0400 Sergei Gorelkin sergei_gorel...@mail.ru wrote: 19.02.2012 18:38, Mattias Gaertner пишет: Hi, When I use copy on a PChar (e.g. copy(p,1,1)), it is very slow, because the compiler converts the PChar to a string. Not sure why it is allowed in the first

Re: [fpc-devel] copy for PChar

2012-02-19 Thread Mattias Gaertner
On Sun, 19 Feb 2012 17:31:48 +0100 (CET) mar...@stack.nl (Marco van de Voort) wrote: In our previous episode, Mattias Gaertner said: When I use copy on a PChar (e.g. copy(p,1,1)), it is very slow, because the compiler converts the PChar to a string. Is there already a function for

Re: [fpc-devel] copy for PChar

2012-02-19 Thread Sergei Gorelkin
19.02.2012 20:34, Mattias Gaertner пишет: Is there already a function function Copy(StartPos: PChar; Count: PtrUInt; StopAt0: boolean = true): string; I don't know about an already existing such function (well, actually SetString used to work that way in the past, but no longer), but here's

Re: [fpc-devel] copy for PChar

2012-02-19 Thread Marco van de Voort
In our previous episode, Mattias Gaertner said: http://www.freepascal.org/docs-html/rtl/strings/strlcopy.html Thanks. But apparently I was not exact enough. Copy has the nice feature, that the bounds are checked. For PChar it does that too, but it always runs through the whole PChar