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

Florian Klaempfl florian at freepascal.org
Sun Apr 25 13:00:16 CEST 2010


Jürgen Hestermann schrieb:
>> Florian Klaempfl schrieb:
>> Simply because dereferencing a dyn. arrays makes no sense because
>> it is more than just a simply data collection.
> 
> Realy? What else is happening in the background?

Reference counting (also of the stored data), automatic length storage.

>> This is plainly wrong. When indexing a dyn. array, the compiler
>> generates the correct code to access the data, no more no less.
> 
> So what is the difference between 'MyArray[0]' and 'MyArray^'? 

MyArray[0] enforces range checking if it is enabled, further
differences, see below.

> Don't
> they mean the same address? 

I would expect to get @MyArray[0]-sizeof(pointer)*2 when doing MyArray^
(which is not allowed), because this is the start of the actual array
information.



More information about the fpc-pascal mailing list