[fpc-devel] Question on function overloading and pointer types
Wayne Sherman
wsherman at gmail.com
Wed Feb 26 00:09:48 CET 2025
Bart wrote:
> > Q1: do we have some documentation about this overload selection process?
> > Q2: if not, then is the observed behaviour of current fpc by design or
> > undefined?
Depending on the mode @variable can return an untyped pointer
(@my_integer is type Pointer) or a typed pointer (@my_integer is type
^integer). The compiler uses the type to determine which overloaded
procedure to call.
https://www.freepascal.org/docs-html/prog/progsu75.html
"In the {$T+} or {$TYPEDADDRESS ON} state, the @ operator, when
applied to a variable, returns a result of type ^T, if the type of the
variable is T. In the {$T-} state, the result is always an untyped
pointer, which is assignment compatible with all other pointer types."
See also:
https://wiki.freepascal.org/Pointer#Data_Type
More information about the fpc-devel
mailing list