l*u 发帖数: 9 | 1 Anybody can give me the answer for the following question? Thanks.
Is there a difference between the "if" test 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; | p******f 发帖数: 162 | 2
no difference, somebody suggusts the second should be preferred, because
MAX_VALUE is not an LVALUE, you can't accidentally write "==" as "=" ...
【在 l*u 的大作中提到】 : Anybody can give me the answer for the following question? Thanks. : Is there a difference between the "if" test 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;
|
|