Signed integer overflow is undefined behavior
Specialization | std::numeric_limits |
std::numeric_limits |
numeric_limits |
||
numeric_limits |
||
numeric_limits |
||
numeric_limits |
||
numeric_limits |
||
numeric_limits |
||
numeric_limits |
||
numeric_limits |
||
numeric_limits |
||
numeric_limits |
||
numeric_limits |
||
numeric_limits |
||
numeric_limits |
demo
1
reference
INT32-C. Ensure that operations on signed integers do not result in overflow