pTAL Reference Manual (H06.08+)
Built-In Routines
HP pTAL Reference Manual—523746-006
15-30
$CARRY
$CARRY
$CARRY returns a value that indicates whether an arithmetic carry occurred during
certain arithmetic operations or during execution of a SCAN or RSCAN statement.
The value returned by $CARRY is based on instructions emitted by the compiler that
determine whether a carry occurred. $CARRY returns -1 if a carry occurred, 0
otherwise.
Procedures cannot return $CARRY.
You can test $CARRY only after one of the following statements:
•
An assignment statement in which the final operator executed in the expression on
the right side of the assignment is one of the following:
°
Signed integer add, subtract, or negate
°
Unsigned integer add, subtract, or negate
•
A SCAN or RSCAN statement.
$CARRY cannot be an actual parameter. If it is important to pass the value of $CARRY
to a procedure, use code similar to that in Example 15-17 on page 15-30.
pTAL privileged procedure No
Can be executed only by privileged procedures No
Sets condition code No
Sets $CARRY No
Sets $OVERFLOW No
Example 15-17. $CARRY Routine
INT a, carry_flag;
carry_flag := 0;
a := a + 1;
IF $CARRY THEN carry_flag := 1;
CALL p1(carry_flag, .... );
VST076.vsd
$CARRY










