[fpc-pascal]force ansistrings to be copied on duplication

Jonas Maebe jonas at zeus.ugent.be
Thu Jul 29 09:29:30 CEST 2004

On 29 jul 2004, at 06:33, Marc Santhoff wrote:

> according to the manual AnsiStrings are 'copied on change'.


> Can the compiler be forced to copy on duplication?

No, but the RTL can be:

Procedure UniqueString(Var S : AnsiString);

This procedure will make variable S point to an ansistring with the 
same contents as the current one, but with reference count 1 (so it 
will generate a copy if necessary).


More information about the fpc-pascal mailing list