Quick start manual
4-12
Delphi Language Guide
Expressions
For most simple types, comparison is straightforward. For example, I = J is True just 
in case I and J have the same value, and I <> J is True otherwise. The following rules 
apply to relational operators.
• Operands must be of compatible types, except that a real and an integer can be 
compared.
• Strings are compared according to the ordinal values that make up the characters 
that make up the string. Character types are treated as strings of length 1.
• Two packed strings must have the same number of components to be compared. 
When a packed string with n components is compared to a string, the packed 
string is treated as a string of length n.
• Use the operators <, >, <=, and >= to compare PChar (and PWideChar) operands 
only if the two pointers point within the same character array.
• The operators = and <> can take operands of class and class-reference types. With 
operands of a class type, = and <> are evaluated according the rules that apply to 
pointers: C = D is True just in case C and D point to the same instance object, and C 
<> D is True otherwise. With operands of a class-reference type, C = D is True just 
in case C and D denote the same class, and C <> D is True otherwise. This does not 
compare the data stored in the classes. For more information about classes, see 
Chapter 7, “Classes and objects”.
Class operators
The operators as and is take classes and instance objects as operands; as operates on 
interfaces as well. For more information, see Chapter 7, “Classes and objects” and 
Chapter 10, “Object interfaces”.
The relational operators = and <> also operate on classes. See “Relational operators” 
on page 4-11.
The @ operator
The @ operator returns the address of a variable, or of a function, procedure, or 
method; that is, @ constructs a pointer to its operand. For more information about 
pointers, see “Pointers and pointer types” on page 5-27. The following rules apply to 
@.
•If X is a variable, @X returns the address of X. (Special rules apply when X is a 
procedural variable; see “Procedural types in statements and expressions” on 
page 5-32.) The type of @X is Pointer if the default {$T–} compiler directive is in 
effect. In the {$T+} state, @X is of type ^T, where T is the type of X (This distinction 
is important for assignment compatibility, see “Assignment-compatibility” on 
page 5-38).
•If F is a routine (a function or procedure), @F returns F’s entry point. The type of 
@F is always Pointer.










