[fpc-pascal] Array clearing
juergen.hestermann at gmx.de
Tue Apr 4 15:43:54 CEST 2017
Am 2017-04-04 um 15:18 schrieb Jürgen Hestermann:
> var MyArray : array of array of integer;
> you can do:
> So MyArray points to an array of 2 integers,
> MyArray points to an array of 3 integers and
> MyArray points to an array of 4 integers.
The syntax of dynamic and static arrays are the same
although they should differ (because the involved pointers).
Therefore it is confusing and misleading.
For dynamic arrays
MyArray should be MyArray^ and
MyArray[0,1] should be MyArray^^
and so on...
This would make it possible to distinguish between the pointer
(MyArray) and the data it points to (MyArray^).
Also MyArray^^ would be a pointer while
MyArray^^^ would be the (static) array of integers.
But as you seldom access the pointers themself (they
are managed by the compiler) and because this automatic
derefencing of pointers for managed types has been defined
decades ago we have to live with this now...
More information about the fpc-pascal