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

Florian Klaempfl florian at freepascal.org
Sun Apr 25 19:21:58 CEST 2010


Jürgen Hestermann schrieb:
>>> True. As I said: There is no common logic what the identifier "MyArray"
>>> means if it is a dynamic array (but there is for static arrays).
>> It means the whole array (which is an opaque type). No more no less.
> 
> Then it should be possible to use "MyArray" as a parameter for
> move/fillchar but obviously this is not the case.

No. Because it does not mean the *array's data* but the *array*.

> 
>>> It's true that it ignores all *type* info. Still there was no ambigouity
>>> about the starting address of a variable you give as parameter until
>>> dynamic arrays were introduced (including AnsiStrings).
>> The same applies to classes.
> 
> Maybe, but why not simply use the starting address of the array when
> using "MyArray" as parameter for fillchar/move? It would have avoided a
> lot of trouble.

If people don't pretent to be clever and just use copy instead of the
low level procedure move, this would avoid *real* trouble.



More information about the fpc-pascal mailing list