l******n 发帖数: 9344 | 1 Is there a difference between the "if" tests shown below? If so, explain
why one might be preferred over the other.
if (*p == MAX_VALUE) return -1;
if (MAX_VALUE == *p) return -1;
thanks | o******r 发帖数: 259 | 2 no difference.
second is preferred.
why?
because you can't take = as == by mistake.
【在 l******n 的大作中提到】 : Is there a difference between the "if" tests shown below? If so, explain : why one might be preferred over the other. : if (*p == MAX_VALUE) return -1; : if (MAX_VALUE == *p) return -1; : thanks
|
|