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

J├╝rgen Hestermann juergen.hestermann at gmx.de
Sun Apr 25 10:44:23 CEST 2010

> 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. 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. It would have been better to dereference the pointer for these functions too. I don't know why Borland did not do that. Now we have to live with this mess only because of Delphi compatibility.

More information about the fpc-pascal mailing list