TAL Programmer's Guide

Using Parameters
Using Procedures
096254 Tandem Computers Incorporated 11–21
Value parameters are described next, followed by reference parameters.
Using Value Parameters If a procedure or subprocedure declares a formal parameter as a value parameter,
callers in effect pass a copy of the actual parameter. The called procedure or
subprocedure can modify the parameter as if it were a local or sublocal variable but
cannot modify the original variable in the caller’s scope.
The compiler allocates storage for parameters in the parameter area of the called
procedure or subprocedure. For value parameters, the kind of parameter and the
parameter type determine the amount of space that is allocated. Table 11-4
summarizes the amount of storage the compiler allocates for formal value parameters:
Table 11-4. Value Parameter Storage Allocation
Formal Parameter Parameter Type Allocation Actual Parameter
Simple variable or
constant expression
STRING
INT
*
UNSIGNED(1–16)
*
Word Simple variable or
constant expression
Simple variable or
constant expression
INT(32)
**
REAL
UNSIGNED(17–31)
Doubleword Simple variable or
constant expression
Simple variable REAL(64)
FIXED(
*
)
FIXED(n)
Quadrupleword Simple variable
Constant expression REAL(64)
FIXED(n)
Quadrupleword Constant expression
16-bit procedure address PROC—or its alias
PROC(16)
Word Procedure with 16-bit
address
32-bit procedure address PROC(32) Doubleword Procedure with 32-bit
address
*
An INT or UNSIGNED(16) actual parameter can be a standard address.
**
An INT(32) actual parameter can be an extended address.
Simple Variables as Value Parameters
When you declare a simple variable as a formal value parameter, specify its parameter
type and identifier but omit any indirection symbol:
PROC my_proc (a, b, c);
INT a, b, c; !Declare value parameters
BEGIN
!Lots of code
END;
Passing INT, INT(32), REAL, and REAL(64) simple variables as value parameters is
straightforward. Passing STRING, FIXED, and UNSIGNED simple variables is
described in the following subsections.