3 ms·
>although we've collectively decided that we prefer to have 2,147,483,647 + 1 = -2,147,483,648. (in both C++ or rust in release mode) Signed integer overflow i
by Ut_Pwnsim 6y ago
>although we've collectively decided that we prefer to have 2,147,483,647 + 1 = -2,147,483,648. (in both C++ or rust in release mode)
Signed integer overflow is undefined behavior in C++. Only unsigned integers are defined to wrap like that.
https://stackoverflow.com/a/16188846 https://stackoverflow.com/a/16188846