[fpc-devel] copy for PChar

Sergei Gorelkin sergei_gorelkin at mail.ru
Sun Feb 19 17:01:11 CET 2012


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} only (should be possible because copy is partially handled by compiler).

> Is there already a function for PChar?
>
> Can an overloaded version of copy be added?
>
It is a question how to interpret indices then (PChar is zero-based while strings are 1-based).
And actually it will mean 4 overloads: PChar, PWideChar, array of char, array of widechar.

Regards,
Sergei



More information about the fpc-devel mailing list