Originale-mail to me for new edition

 

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. 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.) 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.

·  If F is a routine (a function or procedure), @F returns F’s entry point. The type of @F is always Pointer.

·  When @ is applied to a method defined in a class, the method identifier must be qualified with the class name. For example,

@TMyClass.DoSomething

points to the DoSomething method of TMyClass. For more information about classes and methods, see Classes and objects.

 

Topic groups

 

See also

About operators

Operator precedence rules

 

 

译文

 

地址(@)运算符

 

@运算符返回变量、函数、过程或方法的地址;也就是说,@对其操作数构造了一个指针。有关指针的更多信息,见指针和指针类型。下列规则适用于@运算符。

·  如果X是一个变量,那么@X返回X的地址。(当X是程序型变量时适用特殊规则,见语句和表达式中的程序型类型。)当编译指示 {$T-} 有效时,@XPointer类型。而在编译指示 {$T+} 状态下时,@X ^T 类型,这里的TX的类型。

·  如果 F 是一个例程(函数或过程),那么@F返回 F 的入口点,@F的类型总是Pointer

·  @ 适用于定义在类中的方法时,方法标识符必需被类的名称限定。例如

@TMyClass.DoSomething

指向TMyClass类的DoSomething方法。更多关于类和方法的信息,见类和对象

 

主题组

 

相关主题

运算符

运算符优先规则