Type-checked pointers (Delphi)
Go Up to Delphi Compiler Directives (List) Index
Type |
Switch |
Syntax |
{$T+} or {$T-} {$TYPEDADDRESS ON} or {$TYPEDADDRESS OFF} |
Default |
{$T-} {$TYPEDADDRESS OFF} |
Scope |
Global |
Remarks
The $T directive controls the types of pointer values generated by the @ operator and the compatibility of pointer types.
In the {$T-} state, the result of the @ operator is always an untyped pointer (Pointer) that is compatible with all other pointer types. When @ is applied to a variable reference in the {$T+} state, the result is a typed pointer that is compatible only with Pointer and with other pointers to the type of the variable.
In the {$T-} state, distinct pointer types other than Pointer are incompatible (even if they are pointers to the same type). In the {$T+} state, pointers to the same type are compatible.