[fpc-devel] static vs dynamic arrays

Пётр Косаревский ppkk at mail.ru
Tue Apr 4 16:12:44 CEST 2006


> Because of the copy-on-write mechanism. The reference count must be
> checked each time you do a write. This is normal. It's the same in
> Delphi, and a good reason for avoiding dynamic arrays.
> 
> You can use pointer arithmetics in FPC, it works as a dynamic array, but
> without the overhead.

This topic (when trying to read it from the beginning to this point) is informative about its subject, but very confusing.

I have already been confused with blockread() and dynamic arrays. (It's about "formal const" parameter and ability to pass one kind of array as parameter and inability to pass the other.)

Also I constantly fear array assignments.

Probably I will use something similar to your example ("manual" dynamic array?).

Could anyone state the reason of the way dynamic arrays are implemented?
Can I "disable" reference counting for some types or something?



More information about the fpc-devel mailing list