pTAL Guidelines for TAL Programmers
Coding Guidelines
pTAL Guidelines for TAL Programmers—527256-002
2-55
STACK, STORE, and CODE Statements
STACK, STORE, and CODE Statements
In TAL, you can use CODE statements to execute specific TNS hardware instructions.
pTAL does not support CODE statements, STACK statements, or STORE statements.
Topics:
•
STACK and STORE Statements on page 2-55
•
CODE Statements on page 2-55
STACK and STORE Statements
Guideline: Avoid STACK and STORE statements.
pTAL does not support the TAL STACK or STORE statement. Instead, use temporary
variables wherever possible.
If you use STACK and STORE statements to exchange the contents of two variables,
use the following DEFINE instead:
DEFINE exchange(a, b) = STACK a, b; STORE a, b#;
CODE Statements
Guideline: Avoid using CODE statements.
The TAL CODE statement enables you to execute explicitly many of the instructions in
the TNS instruction set.
pTAL does not support CODE statements. For those TNS instructions that are not
available through any other means, pTAL includes built-in routines that provide the
same functionality as TNS instructions you execute using CODE statements.
Avoid writing new code that uses CODE statements. If you must include CODE
statements, embed them in DEFINEs or procedures so that you can easily find and
convert them when you begin using the pTAL compiler.
Note. While you are converting TAL programs to pTAL, including the following directive at the
beginning of each of your source files will ensure that the fields of structure declarations are
aligned according to TAL alignment rules, whether you compile the program with TAL or with
pTAL:
?FIELDALIGN(SHARED2)