...

/

Detecting Overflow and Truncation in Integers

Detecting Overflow and Truncation in Integers

This lesson explains how overflow and truncation can be detected and prevented.

Detecting overflow #

Although detecting overflow uses functions, if conditions and ref parameters, which we have not covered yet, it should be mentioned here that the core.checkedint module contains arithmetic functions that detect overflow. Instead of operators like + and -, this module uses functions: adds and addu for signed and ...