Why is this expression:
int value = 0
if(++value == ++value)
true?
Shouldn't that be equal to if(1 == 2)
? What is it equal to?
Why is this expression:
int value = 0
if(++value == ++value)
true?
Shouldn't that be equal to if(1 == 2)
? What is it equal to?
In c the value of the expression ++value == ++value
is undefined. Technically, this is due to ==
not being a sequencing point..
Informally, this means that you don't know the order that evaluation of ++
and ==
will occur.