TAL Programmer's Guide

Declaring Simple Variables and Arrays in Structures
Using Structures
8–10 096254 Tandem Computers Incorporated
Declaring Arrays
That Use No Memory
If you declare within a structure an array that has bounds of [n:n-1], the compiler
places the identifier of the array in the symbol table but allocates no storage for the
array. You can then apply the array’s data type to subsequent items in the same
structure.
For example, suppose you declare within a structure an INT(32) array that has bounds
of [0:-1], followed by a FIXED variable. If you then assign 0 to the first element of the
INT(32) array, you set the two high-order words of the FIXED variable to 0:
385
0
0
ARRAY
VAR
STRUCT x;
BEGIN
INT(32) array[0:-1];
FIXED(0) var;
END;
x.array[0] := 0D;
Allocating Simple Variables
and Arrays in Structures
The data type of simple variables and arrays declared within a structure determines
the storage unit that the compiler allocates for the variable or array:
Data Type Storage Unit
STRING Byte
INT Word
INT(32) or REAL Doubleword
REAL(64) or FIXED Quadrupleword
UNSIGNED Bit sequence of specified width
Alignment of Simple
Variables and Arrays
The compiler aligns and pads simple variables and arrays in structures as follows:
STRING items are byte aligned.
All other items are word aligned.
If a word-aligned item follows a STRING item that ends on an odd byte, the
compiler allocates a pad byte after the STRING item.