TAL Programmer's Guide
Declaring and Calling Subprocedures
Using Procedures
096254 Tandem Computers Incorporated 11–17
Sublocal Storage
Limitations
Because sublocal storage area is so limited, the way you use sublocal variables is as
important as how many you declare.
When a subprocedure is activated, the compiler allocates the subprocedure's
parameters, variables, and temporary results of expressions in the subprocedure’s
private storage area. The compiler allocates each sublocal item at location S[0],
pushing previously allocated sublocal items to increasingly negative offsets from S[0].
If you attempt to access a sublocal item that is pushed beyond location S[–31], the
compiler issues an error.
To avoid problems, use just a few sublocal parameters and variables and avoid
complex expressions in subprocedures. For example, avoid the following practice:
PROC main_proc MAIN;
BEGIN
SUBPROC sub_oops (f); !Declare SUB_OOPS
INT .f;
BEGIN
INT i[0:24]; !Use 25 sublocal words
f := 1;
f := (f * (f * (f * (f * (f * (f * (f * (f *
(f + 9) + 8) + 7) + 6) + 5) + 4) + 3) + 2) + 1);
END; !Too many temporary values
CALL sub_oops;
END;