News for hackers. Stuff that matters.
Re:A Quiz About Integers in C by jacquesgt on Sunday June 03, 2012 @09:29PM (#4062287)
That is the entire reason. Because the representation of signed numbers could vary from implementation to implementation, making INT_MAX + 1 (or any signed integer overflow) undefined allows for more efficient generated code. If it were defined in some way, the generated code would need checks for overflow wherever it was possible, which would lead to bigger and slower code.

INT_MAX + 1 is never 0 for unsigned int. (unsigned)INT_MAX + 1 is equal to INT_MAX + 1. You're thinking of UINT_MAX + 1, which is always 0.

Re:A Quiz About Integers in C by caf on Sunday June 03, 2012 @11:34PM (#4062545)
It's not true that (unsigned)INT_MAX + 1 is never 0 - it's allowed for UINT_MAX == INT_MAX (leaving the sign bit unused in the unsigned representation). I've never seen such an implementation, though.
Re:A Quiz About Integers in C by jacquesgt on Monday June 04, 2012 @01:08AM (#4062766)
Yep, you're right.
Re:A Quiz About Integers in C by matheusalmeida on Monday June 04, 2012 @04:12AM (#4063098)
Yes, my mistake. I meant UINT_MAX + 1.