TAL Programmer's Guide
Declaring Simple Variables
Using Simple Variables
096254 Tandem Computers Incorporated 6–3
Global, Local, and Sublocal Initializations
At the global level, initialize variables with expressions that contain only constants or
LITERALs as operands. At the local or sublocal level, you can use any arithmetic
expression, including previously declared variables:
INT global := 34; !Only constants allowed in
 ! global initializations
PROC mymain MAIN;
 BEGIN
 INT local := global + 10; !Any expression allowed in
 INT local2 := global * local; ! local and sublocal
 FIXED local3 := $FIX(local2); ! initializations
 !Lots of code
 END; !End of MYMAIN procedure
Allocating Simple Variables The compiler allocates storage in the global, local, or sublocal storage area based on
the level at which you declare the variable, as shown in Figure 6-1. The question
marks in the diagram denote undefined bytes.
Figure 6-1. Simple Variable Storage Allocation
STRING a; !Global data
STRING b;
INT c; 
PROC proc_a;
 BEGIN
 STRING d; !Local data
 REAL e;
 SUBPROC subproc_a;
 BEGIN
 INT f; !Sublocal data
 FIXED g;
 !Lots of code
 END;
 !More code
 END; 
G[0]
S[0]
Global 
data
?A
G[1]
G[2]
L[1]
L[2]
S[-4]
?B
C
. . . 
D ?
F
S[-3]
S[-2]
S[-1]
L[3]
Local 
data
Sublocal 
data
. . . 
G
351
E
Storage allocation specific to each data type is described in “Simple Variables by Data
Type” later in this section. Storage allocation in programs that include BLOCK
declarations is described in Section 14, “Compiling Programs.”










