pTAL Conversion Guide

Hardware Indicators
pTAL Conversion Guide527302-002
20-5
OVERFLOW_TRAPS Procedure Attribute
OVERFLOW_TRAPS Procedure Attribute
In pTAL, you can use the OVERFLOW_TRAPS and NOOVERFLOW_TRAPS
procedure and subprocedure attributes to enable or disable overflow traps for a
procedure or subprocedure. These attributes specify the default overflow trapping
behavior for the procedure with which they appear.
You can specify OVERFLOW_TRAPS and NOOVERFLOW_TRAPS in the source
code you compile with pTAL and with TAL, but with TAL, the procedure attributes do
not affect the trapping characteristics of your program or the object code generated by
the TAL compiler.
For pTAL programs compiled by using a native compiler, an overflow-trapping
procedure attribute overrides the current setting of the overflow-trapping compiler
directive.
The object code produced by the TAL compiler for the code in Example 20-2 on
page 20-5 is not affected by the compiler directive or by the procedure or
subprocedure attributes. By default, all of the code, runs with overflow traps enabled
unless you specify a BEGIN-END block-level overflow-trapping attribute.
?NOOVERFLOW_TRAPS ! Correct use of OVERFLOW_TRAPS directive
! because it is between procedure
PROC q; ! declarations
BEGIN
...
END;
Example 20-2. OVERFLOW_TRAPS Procedure Attribute
?OVERFLOW_TRAPS
PROC x NOOVERFLOW_TRAPS;
BEGIN
...
END;
PROC y;
BEGIN
...
END;
PROC z NOOVERFLOW_TRAPS;
BEGIN
SUBPROC s OVERFLOW_TRAPS;
BEGIN
...
END;
...
END;
Example 20-1. OVERFLOW_TRAPS Directive (page 2 of 2)