[fpc-pascal] Pointer question
pascaldragon at googlemail.com
Thu Aug 10 18:49:16 CEST 2023
Hairy Pixels via fpc-pascal <fpc-pascal at lists.freepascal.org> schrieb am
Do., 10. Aug. 2023, 18:30:
> > 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.
Then you simply aren't using them often enough. E.g. the RTTI internal code
is full of them and additional typecasts would simply muddle up otherwise
relatively clear code.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the fpc-pascal