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

Marc Santhoff M.Santhoff at t-online.de
Thu Jul 29 17:13:39 CEST 2004


Am Do, den 29.07.2004 schrieb Jonas Maebe um 09:29:
> On 29 jul 2004, at 06:33, Marc Santhoff wrote:
> 
> > according to the manual AnsiStrings are 'copied on change'.
> 
> Correct.
> 
> > 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).

Ah, yes. Very fine, so I can decide for each string, right what I
needed.

Thank you both,
Marc






More information about the fpc-pascal mailing list