Archive for May 6, 2010

Thursday, May 6, 2010 [Tweets] [Favorites]

C Language Quirks

Daniel Vik (via Mike Ash):

Considering the only change that was made was to change the type, the different output may be a bit confusing. But there is a very good reason for the behavior, and you guessed, it is spelled integer promotion, and the variables a and b are promoted to integer before the addition is executed, and thus the result is always greater or equal to the right hand operand in the comparison.