overflowIndicator
EGL sets the sysVar.overflowIndicator system
variable to 1 when all of the following conditions are true:
- You use V6 exception mode (see Using V6 exception compatibility).
- You have set vgVar.handleOverflow to enable it (see handleOverflow).
- Arithmetic overflow occurs in a user variable.
Use this variable to check for overflow conditions.
If you are not in V6 exception mode, the value of sysVar.overflowIndicator is undefined and there is no guarantee that it is meaningful.
After detection of an overflow condition, sysVar.overflowIndicator is not reset automatically. You must include code in your program to reset sysVar.overflowIndicator to 0 before performing any calculations that can trigger overflow checks.
You can use sysVar.overflowIndicator in the following ways:
- As the source or target in an assignment or move statement (also allowed in the "for count" of a move statement)
- As a variable in a logical expression
- As the argument in an exit or return statement
Characteristics
sysVar.overflowIndicator has
the following characteristics:
- Primitive type
- NUM
- Data length
- 1
- Value saved across segmented converse?
- Yes
Example
The following example checks for an overflow.
a = b / c;
if (sysVar.overflowIndicator != 0)
writeStdErr("Variable overflow in a");
a = -1; // flag this as useless
sysVar.overflowIndicator = 0; // reset this for next test
end