[fpc-pascal] Pointer question

Hairy Pixels genericptr at gmail.com
Thu Aug 10 18:30:16 CEST 2023



> On Aug 10, 2023, at 5:43 AM, Bernd Oppolzer via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:
> 
> PTRADD (p, i) - p is type ANYPTR, i is integer, result is of type ANYPTR
> PTRDIFF (p1, p2) - two pointers, the result is integer
> ANYPTR is a predefined type, compatible with every (typed pointer) 
> ADDR (x) is a function (borrowed from PL/1), which returns an ANYPTR ... and it is allowed for all types of variables
> PTRCAST is the same as PTRADD (p, 0) - and is used to cast pointers between incompatible pointers (not type safe) 
> 

Not a bad idea to clarify this. Besides p + 1 the pointer math operators are difficult to understand and feel antiquated.

Regards,
Ryan Joseph



More information about the fpc-pascal mailing list