TAL Programmer's Guide
Using Indexes or Offsets
Using Equivalenced Variables
096254 Tandem Computers Incorporated 10–19
However, if you assign an address to the structure pointer in the preceding example,
both the structure pointer and the implicit pointer point to the new address, rather
than to the structure data. You can no longer access the structure data.
Avoid the last statement in the following example:
418
INT var1;
INT var2;
STRUCT .str;
BEGIN
INT a[0:3];
INT b[0:9];
END;
INT .ptr (str) = str;
@ptr := 0;
VAR2
ptr to STR
PTR = 0
STR
.
.
.
VAR1G[0]
Primary area
Secondary area
.
.
.
Using Indexes
or Offsets
When you declare equivalenced variables, you can append an index or an offset to the
previously declared variable. Table 10-2 compares indexes and offsets.
Table 10-2. Indexes and Offsets
Specified As: Used With Represents
Index INT constant
(enclosed in
brackets)
Direct
previous
variable
An element offset from the location of the previous
variable (which cannot be a pointer, including an implicit
pointer). The element size depends on the data type of
the previous variable. The indexed location must begin
on a word boundary.
Offset INT constant
(preceded by a
plus (+) or
minus (–))
Direct or
indirect
previous
variable
A word offset from either:
−The location of a direct previous variable.
−The location of the pointer of an indirect previous
variable, not from the location of the data pointed to.