Peter Gerwinski wrote:
function f(var a:t):integer; var p:^integer; begin p:=@a[0]; {some loop} if {...} then begin p^:=...; inc(p) {is this ok, BTW?} end; {...} f:="offset of p in a" end.
"inc(p)" should work in GPC. You can even do
for p:= @a [ 0 ] to @a [ n ] do p^:= ...;
The latter doesn't fit into the procedure above, but if "inc(p)" works, fine!
What about intoducing a "difference between pointers" operator which returns the number of elements they lie apart (as an integer)?
f:= p - @a [ 0 ];
This would be great!
(Only with (*$X+*), of course.)
Of course!