[next] [prev] [prev-tail] [tail] [up]

#### 1.2.75 $T or $TYPEDADDRESS : Typed address operator (@)

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.

For example, the following code will not compile:

{$T+}
Var
I : Integer;
P : PChar;
begin
P:=@I;
end.

The compiler will give a type mismatch error:

testt.pp(8,6) Error: Incompatible types: got "^SmallInt" expected "PChar"

By default however, the address operator returns an untyped pointer.

[next] [prev] [prev-tail] [front] [up]