(autoconf.info)Integer Overflow


Next: Preprocessor Arithmetic Prev: Varieties of Unportability Up: Portable C and C++

12.2 Integer Overflow
=====================

In practice many portable C programs assume that signed integer
overflow wraps around reliably using two's complement arithmetic.  Yet
the C standard says that program behavior is undefined on overflow, and
in a few cases C programs do not work on some modern implementations
because their overflows do not wrap around as their authors expected.
Conversely, in signed integer remainder, the C standard requires
overflow behavior that is commonly not implemented.

* Integer Overflow Basics
Why integer overflow is a problem
* Signed Overflow Examples
Examples of code assuming wraparound
* Optimization and Wraparound
Optimizations that break uses of wraparound
* Signed Overflow Advice
Practical advice for signed overflow issues
* Signed Integer Division
`INT_MIN / -1' and `INT_MIN % -1'

automatically generated by info2www