function Addr (const Foo): Pointer;
Addr
returns the address of its argument. It is equivalent to
the address operator.
Note: In BP, Addr
returns an untyped pointer. GPC does this
only with --borland-pascal
. Otherwise it returns a typed
pointer. Addr
never depends on the
--[no]-typed-address
option/compiler directive, unlike the
address operator. (It is recommended you never rely on untyped
pointer results, but use a type-cast if really necessary.)
Addr
is a Borland Pascal extension.
program AddrDemo; var Foo: ^Integer; Bar: Integer; begin Foo := Addr (Bar); { Let `Foo' point to `Bar'. } Bar := 17; Foo^ := 42; { Change the value of `Bar' to 42 } WriteLn (Bar) end.