[fpc-pascal] dynamic array contents and system.move

Jürgen Hestermann juergen.hestermann at gmx.de
Wed Apr 28 08:05:30 CEST 2010


> I agree that the introduction of managed data types is inconsistent with 
> previous Pascal data types. Perhaps it is a design flaw to have changed 
> the semantics of reference-counted data types. Perhaps not. 
> Nevertheless, it has been this way for many, many years and will not be 
> changed at this point.

I am not sure whether this now cast in stone forever. Errors *can* be corrected sometimes. ;-)

> Correct. The language is no longer as simple and clear and easy as it was.
> The rule now is that you need to know if the data types you use are 
> managed (reference-counted) or not. If they are, you must be aware that 
> lower-level operations such as Move and FillChar will not work the way 
> they did with earlier data types. That is one of the things you trade 
> for the convenience of having some details managed for you when using 
> managed data.

A simple solution would be to use the address the pointer is pointing to (address of first element) for fillchar/move too. Then it would be consistent and the identifier would mean the array in all cases. Because it was stated that these functions should not be used for dynamic arrays anyway only a few code changes would be required to existing code but it would save generations of programmers the anger they have with it now.



More information about the fpc-pascal mailing list