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

José Mejuto joshyfun at gmail.com
Sun Apr 25 18:05:10 CEST 2010


Hello FPC-Pascal,

Sunday, April 25, 2010, 5:38:48 PM, you wrote:

JH> But currently move *does* handle dynamic arrays differently
JH> than other procedures. You can use an array as parameter for a
JH> function or procedure and it does not matter whether it's dynamic
JH> or not. So the identifier means the array in both cases. But this
JH> does *not* apply to move or fillchar! That's illogical.

I think there is a great difference between normal arrays and dynamic
ones, in normal arrays:

A: array [0..1] of integer;
move (a[0],somewhere^,8);

is OK, but in dynamic arrays it should be:

A: array of integer;
SetLength(A,2);
move (a[0],somewhere^,4);
move (a[1],(somewhere+4)^,4);

Because I think dynamic arrays does not garantee that all elements are
together in a big chunck. So something like "move
(A,somewhere^,Length(A)*sizeof(AElement))" is nonsense.

-- 
Best regards,
 José




More information about the fpc-pascal mailing list