TAL Programmer's Guide

Using Parameters
Using Procedures
11–34 096254 Tandem Computers Incorporated
Here is another example that shows the need to store addresses in pointers before
passing them as reference parameters:
STRUCT t (
*
);
BEGIN
INT i;
!More structure items
END;
STRUCT .x (t);
STRING .a (t); !Uninitialized structure pointer
!or INT .a (t);
!or STRING .EXT a (t);
!or INT .EXT a (t);
PROC p (f);
STRUCT .f (t); !Formal reference parameter; the
!or STRUCT .EXT f(t); ! corresponding actual parameter
!or STRING .f (t); ! need not be declared in same way
!or STRING .EXT f (t);
!or INT .f (t);
!or INT .EXT f (t);
BEGIN
f.i := 3;
END;
PROC m MAIN;
BEGIN
CALL p (a); !Not OK, A is not initialized
CALL p (x); !OK, X is initialized
@a := @x; !Address of X is assigned to A
CALL p (a); !OK, A contains a value
END;