C usual arithmetic conversions

前端 未结 4 930
攒了一身酷
攒了一身酷 2020-12-01 15:08

I was reading in the C99 standard about the usual arithmetic conversions.

If both operands have the same type, then no further conversion is needed.

4条回答
  •  星月不相逢
    2020-12-01 15:45

    It is converted to unsigned, the unsigned arithmetic just happens to give the result you see. The result of unsigned arithmetic is equivalent to doing signed arithmetic with two's complement and no out of range exception.

提交回复
热议问题