pTAL Guidelines for TAL Programmers
Coding Guidelines
pTAL Guidelines for TAL Programmers—527256-002
2-4
Guidelines Summary
P Register in Stack Marker on page 2-28 Do not change a procedure’s return
destination by storing a value into the P
register in the stack marker.
Parameter Accesses Using Based-Address
Equivalenced Declarations, Indexing, and
Pointers on page 2-27
Access parameters only by referencing the
name of the parameter.
Reading and Altering Parameter Masks
on
page 2-29
Do not read or alter the parameter mask
passed to variable and extensible
procedures.
Building Parameter Masks
on page 2-31 Use procedure pointers, rather than building
parameter masks, for variable and extensible
procedures.
Parameters and Local Variables
on
page 2-38
Do not assume that there is a relationship
between where a procedure’s parameters
and where its local variables are stored in
memory.
Parameters and Structure Layouts
on
page 2-39
Use structure pointers as formal parameters,
rather than definition or referral structures.
Parameters Are Not Consecutive
on
page 2-37
Do not assume that parameters are stored in
consecutive and contiguous memory
locations.
Using STACK Statements to Pass
Parameters on page 2-37
Pass parameters to procedures and
functions using only high-level constructs.
Incrementing and Decrementing Pointers
on
page 2-17
Use indexing to increment and decrement
pointers.
Referencing Variables and Parameters
on
page 2-6
Access the contents of variables and
parameters only by explicitly naming the
variables or parameters.
RETURN Statement Must Appear in Every
Function on page 2-32
Include at least one RETURN statement in
every function, even if dynamically no
RETURN statement is executed.
Returning a Condition Code
on page 2-48 Specify the RETURNSCC procedure
attribute and explicit condition code value for
procedures that return a condition code.
Returning a Condition Code
on page 2-49 The value returned for the condition code in
pTAL is not always the same as in TAL.
Returning a Value From a Function
on
page 2-32
Always specify a function’s return value as
part of the RETURN statement.
Returning From a Function That Does Not
Specify a RETURN Statement on page 2-32
Always return from a function by executing
an explicit RETURN statement.
RP Directive
on page 2-54 Avoid using code sequences that require you
to use the RP directive.
Topic Guideline (page 4 of 5)