pTAL Guidelines for TAL Programmers
Coding Guidelines
pTAL Guidelines for TAL Programmers—527256-002
2-39
Parameters and Structure Layouts
Parameters and Structure Layouts
Guideline: Use structure pointers as formal parameters, rather than definition or
referral structures.
In TAL, you can declare a parameter whose data type is a definition structure—that is,
you declare the structure layout in the formal parameter declaration, as in
Example 2-41 on page 2-39.
In pTAL, you cannot declare a definition structure as a formal parameter. To achieve
the same effect in pTAL (or TAL), declare the parameter as a structure pointer, as in
Example 2-42 on page 2-39.
@ Operator With PROC, PROCPTR, and PROCADDR Formal
Parameters
Guideline: Apply the @ operator to a procedure name that you pass as an actual
parameter only if the formal parameter is type PROCADDR. Do not apply the @
operator to a formal parameter of type PROC or PROCPTR.
In TAL, you can optionally apply an @ operator to a procedure name that you pass as
the actual parameter to a formal parameter of type PROC. Whether or not you apply
an @ operator to the procedure name, however, does not affect the value that is
passed to the procedure.
Example 2-41. Definition Structure as Formal Parameter (TAL Only)
PROC p(s);
STRUCT .s;
BEGIN
INT a;
INT b;
END;
BEGIN
...
END;
Example 2-42. Structure Pointer as Formal Parameter
STRUCT s(*); ! Template
BEGIN
INT a;
INT b;
END;
PROC p (i);
INT .i(s); ! Layout of structure pointer i is defined by s
BEGINS
...
END;