[fpc-pascal] AnsiString address changed
Hairy Pixels
genericptr at gmail.com
Mon Mar 18 09:27:38 CET 2024
> On Mar 18, 2024, at 1:52 PM, Michael Van Canneyt via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:
>
> An ansistring is a pointer to a memory block.
>
> You are printing the address of S1 and the address of S, i.e. the address of
> the pointer itself, not the address of what S (or s1) points to. Obviously the address of the s is different of s1.
>
> What you want to do is print hexstr(pointer(s))
> if you do that, you'll have the same output 3 times.
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.
Regards,
Ryan Joseph
More information about the fpc-pascal
mailing list