Question about C behaviour for unsigned integer underflow
- by nn
I have read in many places that integer overflow is well-defined in C unlike the signed counterpart.
Is underflow the same?
For example:
unsigned int x = -1; // Does x == UINT_MAX?
Thanks.
I can't recall where, but i read somewhere that arithmetic on unsigned integral types is modular, so if that were the case then -1 == UINT_MAX mod (UINT_MAX+1).