[fpc-pascal] Dynamic arrays, yet another pitfall
Florian Klämpfl
florian at freepascal.org
Sun Feb 16 13:47:26 CET 2014
Am 15.02.2014 19:41, schrieb Michael Van Canneyt:
>
> That setlength behaves rather freakish for dynamic arrays, does not
> mean we have copy-on-write.
setlength does not behave freaky but its behaviour is well designed. The
reason why setlength does a deep copy is simple: multithreading. If
setlength had no deep copy semantics, it would need locking of the whole
array data, not only locked access to the ref. counter.
More information about the fpc-pascal
mailing list