You can create a new variable that
resides at the same address as another variable. To do so, put the directive absolute
after the type name in the declaration of the new variable, followed by the
name of an existing (previously declared) variable. For example,
var
Str: string[32];
StrLen: Byte absolute Str;
specifies that the variable StrLen
should start at the same address as Str. Since the first byte of a short
string contains the string’s length, the value of StrLen is the length
of Str.
You cannot initialize a variable in an absolute declaration or combine absolute with any other directives.
可以创建一个新的变量,该变量驻留在与另一个变量相同的地址中。要这样做,可以将指示字absolute置于新变量的类型名称之后,并且跟随一个存在的变量名(先前声明过的)。例如
var
Str: string[32];
StrLen: Byte absolute Str;
上面的声明说明,变量StrLen与Str开始于相同的地址。由于短串的第一个字节包含了串的长度,因此StrLen的值就是Str的长度。
对于在absolute声明中或联合absolute与其他指示字的声明中的变量,不能对其进行初始化。