[fpc-pascal] Pointer question
genericptr at gmail.com
Wed Aug 9 15:46:54 CEST 2023
> On Aug 8, 2023, at 11:53 PM, Sven Barth via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:
> By default @ returns a *untyped* pointer that can be assigned to any pointer type. Thus is compatible with Delphi and can be controlled with the $TypedAddress directive (there's a slight exception to this when you assign a pointer to a function to a function variable (etc) or pass it to such a parameter, because the compiler has to pick the correct overload if there are multiple functions with the same name in scope).
Oh $TypedAddress, I had learned about this some time ago for another reason. I was always programming under the assumption @ was typed and just noticed this now.
The next question is why @ is untyped (if it's just for Delphi why isn't it behind the Delphi mode). This breaks type safety does it not?
More information about the fpc-pascal