for (i = 0; i <= N; ++i) { ... }
This particular operator will cause an infinite loop if N is equal INT_MAX. It is known that Unsigned Overflows are overflows the assumption iand Nfor unsigned, the compiler can be assumed that the loop will iterate exactly N+1once, if ithere is an overflow undefined. The following should be noted here: if I create loops like,
for (i = 0; i < N; ++i) { ... }
Will it still be undefined behav?
Why is it INT_MAX + 1not necessarily equal INT_MINin the case of signed integers?
user2045557
source
share