boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - what's the difference
相关主题
does any one know the answer?
Any difference between class and typename identifier?
How does YAHOO calculate RSI? (转载)
请教一个design的问题
one interview question
difference between FILE and struct FILE
What is the difference between operator new and the new
c++下如何实现多线程?
what is difference between 0x0008 and 8?
a question
相关话题的讨论汇总
话题: difference话题: max话题: value话题: what话题: return
进入Programming版参与讨论
1 (共1页)
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

1 (共1页)
进入Programming版参与讨论
相关主题
a question
问一个比较
我也问个UDP网络编程中遇到的问题
What is the difference between WM_close and WM_CLOSE?
[合集] What are the differences between "const char* p" and "c
placement new
Dreamweaver 能不能象Word一样, WYSIWYG ?
c的memory layout和c++的memory layout有什么不同?
what's the difference between a .cpp file and a compilation unit?
interview question: what is the difference between Java and c++
相关话题的讨论汇总
话题: difference话题: max话题: value话题: what话题: return