TAL Programmer's Guide

Using Parameters
Using Procedures
11–28 096254 Tandem Computers Incorporated
In the CALL statement, do not modify the content of an index register. If you do so,
the index register contains the original (unmodified) content when control returns to
the caller, and the compiler emits an error message. Avoid the following practice:
PROC some_proc (f);
INT f;
BEGIN
!Lots of code
END;
PROC m MAIN;
BEGIN
USE x;
x := 1; !X contains 1
!Lots of code
CALL some_proc (x := x + 2);
!Pass X; change its value to 3
!Upon return, X still contains 1
DROP x;
END;
If you must modify the content of an index register, assign a new value to the index
register before listing the index register in the CALL statement. Here is an example:
PROC some_proc (f);
INT f;
BEGIN
!Lots of code
END;
PROC m MAIN;
BEGIN
USE x;
x := 1; !X contains 1
!Lots of code
x := x + 2; !Assign new value to X
CALL some_proc (x); !Pass X
!Upon return, X contains 3
DROP x;
END;