TAL Programmer's Guide

Declaring Definition Structures
Using Structures
096254 Tandem Computers Incorporated 8–5
Extended Indirect Structures
For each extended indirect structure, the compiler allocates space as follows:
1. It allocates two words of storage in the global (or local) primary area of the user
data segment for the implicit extended structure pointer.
2. Next, it allocates storage for the structure in the automatic extended data segment.
3. Finally, it initializes the implicit pointer (provided in Step 1) with the 32-bit byte
address of the zeroth structure occurrence.
Word Boundaries
The compiler starts the allocation of each structure occurrence on a word boundary,
even if each occurrence contains an odd number of bytes.
For example, the compiler starts structure occurrences A[0] and A[1] on a word
boundary as follows. (Slashes in the diagram represent compiler-allocated pad bytes.)
STRUCT a_struct[0:1];
BEGIN
INT x;
STRING s;
END;
A_STRUCT[0]
A_STRUCT[1]
380
X
S / / /
X
S
/ / /
Amount of Allocation
The compiler determines the amount of storage to allocate for the structure data from
the size and number of structure occurrences. The compiler allocates storage only for
the structure occurrences specified in the bounds of the declaration.
For example, if you declare simple variables A and B, and then declare structure S
with bounds of [1:2], the compiler allocates storage for A, B, S[1], and S[2] as follows.
In this case, the zeroth occurrence of S is located at the address of simple variable A:
INT a;
INT b;
STRUCT my_struct[1:2];
BEGIN
INT s_c;
STRING s_d;
END;
381
MY_STRUCT[0]
MY_STRUCT[1]
MY_STRUCT[2]
A
B
S_C
S_D / / /
S_C
S_D / / /
Note
When your code later refers to a structure occurrence, the compiler does no bounds checking. If you
refer to a structure occurrence outside the bounds specified in the declaration, you access data at an
address outside of the structure.