pTAL Reference Manual (H06.03+)
Equivalenced Variables
HP pTAL Reference Manual—523746-005
11-7
Memory Usage for Nonstructured Equivalenced
Variables
Memory Usage for Nonstructured Equivalenced Variables
The memory referenced by an equivalenced variable including all fields of an
equivalenced structure and all elements of an equivalenced array must be contained
entirely within the memory allocated for the previous variable. You can index the
previous variable, but the memory referenced after applying the index must be
contained within the memory allocated for the previous variable.
An equivalenced variable, including all elements of an equivalenced array or
equivalenced structure, must be the same size or smaller than the lowest-level
previous variable, even if an intermediate previous variable is not as the equivalenced
variable you are declaring:
INT h;
FIXED i;
INT j = i; ! OK: j is smaller than i
INT(32) k = j; ! OK: k is 32 bits, i is 64 bits
FIXED l = h; ! ERROR: l > h
The number of bits in an equivalenced variable (including all elements of an array or
structure) must be less than or equal to the number of bits in the previous variable.
Equivalenced variables for which the previous variable is itself an equivalenced
variable, must be contained entirely within the memory allocated for the previous
variable for which the compiler allocates memory.
Equivalenced Arrays
Use the lower-bnd1 and upper-bnd2 parameters as shown in the nonstructure
declaration syntax.
Example 11-3. Memory Usage for Nonstructured Equivalenced Variables
FIXED i; ! i is 64 bits
INT(32) j[0:1] = i; ! OK: j is 64 bits and coincident with i
INT k[0:1] = i; ! OK: k is 32 bits and contained within i
INT m[0:3] = k; ! OK: Although m is 64 bits and k is
! 32 bits, pTAL requires only that
! m be contained within i, not k.
INT x[0:15];
FIXED y = x[10]; ! ERROR: y does not fit entirely within x










