Am 2014-02-09 16:34, schrieb Flávio Etrusco: > In other words: dynamic arrays are like AnsiStrings without the > copy-on-write semantics. I'd certainly wish Borland copied the COW > semantics :-/
Yes. Therefore the issue that I described for dynamic arrays cannot occur for ansistrings. But COW can also be a drawback. Imagine an ansistring within a record of a heavily pointer-connected deeply nested data structure and I want to write a function that gives me back a reference to this string: --------------------------------- function FindMyStringToModify : AnsiString; ... var A : AnsiString; A := FindMyStringToModify; A := 'New String'; --------------------------------- then the change to A will not affect the ansistring in the nested data structure (because of COW). But this is possible for dynamic arrays *if* they are not empty. _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal