When comparing a type larger than int
, with an integer constant, should I place the constant on the left or the right to ensure the correct comparison is performed?
int64_t i = some_val;
if (i == -1)
or should it be:
if (-1 == i)
Are there any circumstances in which either case is not identical to comparison with -1LL
(where int64_t
is long long
)?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…