TAL Programmer's Guide
Declaring Simple Variables and Arrays in Structures
Using Structures
096254 Tandem Computers Incorporated 8–11
This example shows how the compiler allocates STRING simple variables (VAR1 and
VAR2) and STRING arrays (A, B, and C) on byte boundaries. The compiler allocates a
pad byte following array C because VAR4 must be word aligned.
STRUCT .padding;
BEGIN
STRING var1;
STRING var2;
INT var3;
STRING a[0:2];
STRING b[0:1];
STRING c[0:3];
INT var4;
END;
386
VAR1
VAR3
A[0]
A[2] B[0]
B[1]
C[1] C[2]
C[3]
VAR4
VAR2
C[0]
/ / /
A[1]
Allocating UNSIGNED Structure Items
The compiler packs the bits of UNSIGNED simple variables and arrays declared inside
a structure in the same way as those declared outside a structure.
For example, the compiler allocates two bits for Y on a word boundary within
structure Z and then then allocates four bits for X in the same word unit. The compiler
also allocates ten pad bits following X because V must be word aligned.
STRUCT .EXT z;
BEGIN
UNSIGNED(2) y;
UNSIGNED(4) x;
INT v;
END;
387
X
V
Y / / /