An Exception representing the cause of an integer math failure.
The module description, above, explains the different policies.
Represents a single cause of failure for an integer math operation.
A bitset that can be used to track integer math failures.
Get the IntFlagPolicy associated with some type T.
Function used to signal a failure and its proximate cause from integer math code. Depending on the value of the policy parameter, raise() will either:
Common error signaling facilities for the checkedint package.
$(BIG $(B `IntFlagPolicy.throws`))
When the throws policy is set, errors are signalled by simply throwing a new CheckedIntException. This is the recommended policy because:
However, this approach is not suitable in all cases. In particular:
$(BIG $(B `IntFlagPolicy.asserts`))
When the asserts policy is set, errors trigger an assertion failure. The result depends upon whether assertions were enabled at compiler time:
The asserts policy is the only one that is compatible with pure nothrow @nogc code.
$(BIG $(B `IntFlagPolicy.sticky`))
An alternative error signalling method may be selected using the sticky policy:
The IntFlags.pushPop mixin can be used to prevent a function from handling or clearing flags that were set by the caller.
Care must be taken when using the sticky policy to insert sufficient if (IntFlags.local) checks; otherwise checkedint will not provide much protection from integer math related bugs.