[fpc-pascal] Dynamic arrays, yet another pitfall

Jürgen Hestermann juergen.hestermann at gmx.de
Sun Feb 16 14:07:25 CET 2014


Am 2014-02-16 13:47, schrieb Florian Klämpfl:
 > 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.

There may be good reasons for doing it the way it has been done.
But for a programmer (who has not written the compiler) this behaviour is totaly unexpected.
When using unknown features of a programming language for the first time
then the documentaion should tell all aspects in detail and describe the exact behaviour.




More information about the fpc-pascal mailing list