3 ms·
Thank you, I wasn't aware that C99 now mandates the twos-complement result; I think it had been implementation-defined in C89 (which is all I ever used seriousl
by prodigal_erik 15y ago
Thank you, I wasn't aware that C99 now mandates the twos-complement result; I think it had been implementation-defined in C89 (which is all I ever used seriously).
http://stackoverflow.com/questions/50605/signed-to-unsigned-conversion-in-c-is-it-always-safe http://stackoverflow.com/questions/50605/signed-to-unsigned-...
- caf 15y agoC89 has this language in §3.1.2.5 Types: A computation involving unsigned operands can never overflow, because a result that cannot be represented by the resulting unsigned integer type is reduced modulo the number that is one greater than the largest value that can be represented by the resulting unsigned integer type.