C++

signed integers and overflow

sub title(optional)

Posted by Liang Yulai on November 21, 2018

Signed integer overflow is undefined behavior

Specialization std::numeric_limits::min() std::numeric_limits::max()
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