pTAL Guidelines for TAL Programmers
Coding Guidelines
pTAL Guidelines for TAL Programmers—527256-002
2-24
Procedures, Subprocedures, and Labels
You can equivalence a pointer to the implicit pointer of an indirect array or indirect
structure, as in Example 2-22 on page 2-24.
In Example 2-22 on page 2-24, p is a read-only pointer—you cannot store into the
pointer. but you can use the pointer to read the address of the indirect array or
structure, or to read or write the data of the array or structure.
pTAL imposes the preceding restrictions on equivalenced variables because the 32-bit
native architecture eliminates the need for implicit pointers. The native compiler,
therefore, usually does not allocate implicit pointers when compiling native object code,
although pTAL retains TAL indirection symbols for language compatibility.
Procedures, Subprocedures, and Labels
TAL provides constructs that enable you to access low-level features of TNS
architecture such as information in the stack marker, TNS registers, and so forth.
pTAL does not support any of these constructs.
Topics:
•
@ Operator With Procedure Names on page 2-25
•
@ Operator With Labels and Subprocedure Names on page 2-25
•
Stack Marker Accesses Using Based-Address Equivalenced Declarations,
Indexing, and Pointers on page 2-26
•
Parameter Accesses Using Based-Address Equivalenced Declarations, Indexing,
and Pointers on page 2-27
•
Overflow Bit in ENV in Stack Marker on page 2-27
•
Carry Bit in ENV in Stack Marker on page 2-28
Example 2-22. Equivalencing a Pointer to an Indirect Pointer
INT .a[0:99];
INT .p = a;
Example 2-23. Using a Pointer to Read the Address of an Indirect Item
STRING .a[0:99]; ! Indirect array
STRING .p = a; ! Read-only pointer to a's data
STRING .s;
STRING .t[0:99] = s; ! ERROR: Invalid equivalence
@s := @a; ! OK: @s is assigned addr of a's data
@s := @p; ! OK: @s is assigned addr of p's data
@a := @s; ! ERROR: Cannot assign into the
! implicit pointer of an indirect array
@p := @s; ! ERROR: Cannot assign into the
! implicit pointer of an indirect array