sample:
PCells = array [0..3] of Byte;
TPArray = array [0..0] of PCells;
PTPArray = ^TPArray;
You can define a larger range:
type TPArray = array[0..(high(sizeint) div sizeof(PCells))-1] of PCells;
if you need also negative indices, then you need pointermath instead.
type {$PointerMath on} PTPArray = ^PCells; {$PointerMath off}
But FPC has a known bug here (if item is static array, issue 35745) under {$modeswitch autoderef} and delphi mode:
Then "var pArrays: PTPArray;" has this pointermath bug:
pArrays[1] is next byte, but should be next array (PCells).
( pArrays^[1] (non-pointermath expression) is correct for returning a byte)
Workaround: (pArrays + 1)^ is next array.
@pArrays[1] refers to next byte, but should refer to next array.
Workaround: (pArrays + 1) refers to next array.