Yoda Conditions and integer promotion

It doesn’t matter whether you put it on the right hand side or the left hand side; the == operator is completely symmetrical.

If both operands to the == operator have arithmetic type, as in this case, then the “usual arithmetic conversions” are applied (C99 §6.5.9). In this case, the rule that applies is:

If both operands have signed integer types or both have unsigned
integer types, the operand with the type of lesser integer conversion rank is
converted to the type of the operand with greater rank. (C99 §6.3.1.8)

So the -1 is converted to int64_t. -1LL makes no difference.

Leave a Comment