pTAL Conversion Guide

Procedures, Subprocedures, and Procedure
Pointers
pTAL Conversion Guide527302-002
16-14
Assigning Values to PROCPTR Variables
By using PROCPTRs in pTAL:
The native compiler can ensure that the procedure attributes and parameter data
types of procedures passed as actual parameters match those defined in the
formal parameters of the called procedure.
The native compiler can build parameter masks for calls to VARIABLE and
EXTENSIBLE procedures.
Assigning Values to PROCPTR Variables
Only values of data type PROCADDR can be assigned to a PROCPTR variable; that
is:
The address of a procedure or function
The value of another PROCPTR
The value of a variable whose data type is PROCADDR
If the left side of the assignment statement is a PROCPTR and right side is an @
character followed by the name of a procedure, subprocedure, or function—that is,
neither the left side nor the right side is a PROCADDR variable—the attributes and the
formal parameter types of each side of the assignment must match. The attributes
specified must be the same but do not have to be presented in the same order.
If either the left side or the right side of the assignment statement is a PROCADDR
variable, the native compiler does not attempt to match attributes or parameter types.
PROC c(pa);
PROCADDR pa;
BEGIN
...
END;
PROC d;
BEGIN
CALL b(a); ! OK
CALL b(@a); ! ERROR: @ character is invalid
CALL c(a); ! ERROR: @ character is required
CALL c(@a); ! OK: @ character is required
END;
Example 16-8. PROCPTR as Formal Parameter (pTAL)
PROC p(pp);
PROCPTR pp(i, j);
INT i, j;
END PROCPTR;
BEGIN
...
END;
Example 16-7. @ Before Actual Procedure Parameters (pTAL) (page 2 of 2)