On Mon, 18 Mar 2024, Hairy Pixels via fpc-pascal wrote:



On Mar 18, 2024, at 3:27 PM, Hairy Pixels <generic...@gmail.com> wrote:

Oh, it's a pointer to a pointer? I guess that explains how it can resize itself 
and not invalidate shared references, if those are even possible with 
AnsiString.

Wait, that's totally wrong. :) @s is the address of the local variable of 
course. I didn't think before I did that. I just wanted the address of the 
AnsiString.

That still doesn't explain how they resize though. There must be not be more 
than 1 reference to any AnsiString at a time.

Of course there must be, that's the whole point of copy-on-write.

As soon as one reference is changed, a copy is made if the reference count
is larget than 1, and this copy is changed.

Michael.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to