[fpc-pascal] dynamic array contents and system.move
Florian Klaempfl
florian at freepascal.org
Sun Apr 25 10:57:07 CEST 2010
Jürgen Hestermann schrieb:
>> David Emerson schrieb:
>> I *am* checking sizes before the move, which is why it surprised me
>> that things were going out of bounds -- the trouble is I forgot the
>> array index [0]
>
> Yes, that happens quite often. Unfortunately, Borland gave up the clear
> und predictable context independend Pascal syntax when implementing
> dynamic data structures.
Simply because dereferencing a dyn. arrays makes no sense because
it is more than just a simply data collection.
> Dynamic arrays are actually *pointers* to the
> data while static arrays are the data itself. But the pointers of
> dynamic arrays are dereferenced automatically when used except for
> fundamental byte functions like move or fillchar.
This is plainly wrong. When indexing a dyn. array, the compiler
generates the correct code to access the data, no more no less.
More information about the fpc-pascal
mailing list