[fpc-devel] copy for PChar

Michael Schnell mschnell at lumino.de
Tue Feb 21 09:43:23 CET 2012


On 02/19/2012 03:38 PM, Mattias Gaertner wrote:
> 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?
How should it work ?
A Phar as a left value sets the pointer to some (hopefully sensible) 
memory location. for a string resulting from "copy" such memory would 
need to be allocated.

IMHO implicitly doing a malloc() and propagate the need to free the 
memory allocation to the user is very ambiguous.

-Michael



More information about the fpc-devel mailing list