4 ms·
Not yet. Consider a = -1, b = 1. Due to the OR, any a and b with different signs will return overflow.
by pbsd 12y ago
Not yet. Consider a = -1, b = 1. Due to the OR, any a and b with different signs will return overflow.
- professorTuring 12y agoOk this is my dumbest time in life xD (I just directly didn't take into consideration that part because it never has overflow...)...
- barrkel 12y agoMost people don't appreciate how complicated C's mix of signed and unsigned is, especially when undefined behaviour of signed overflow is included.
- professorTuring 12y agoDefinitely. Child, this is why I always add unit tests.