由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Unix版 - A C++ question
相关主题
[转载] how to get the return value of a command by shell?How to send email in C program.
SOS!FreeBSD expert needed!Does Linux support thread?
how to delete a file with NULL name in unix? (转载)How to debug C program in Unix
Re: [转载] how to get the return value of a command by shell?How can run fortran language in Window NT?
coconut 申请 unix BZWhat's C++ compliler on Tru64 Unix?
[转载] Re: 请问unix下如何编写图形界面Is there a C++ compiler coming w/ Solaris x86?
C++ Help under UNIX关于CPU时间急问!
C++ std lib help?[转载] 不好意思,非常简单的C++问题
相关话题的讨论汇总
话题: max话题: value话题: c++话题: question话题: return
进入Unix版参与讨论
1 (共1页)
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;

1 (共1页)
进入Unix版参与讨论
相关主题
[转载] 不好意思,非常简单的C++问题coconut 申请 unix BZ
[转载] emacs problem[转载] Re: 请问unix下如何编写图形界面
How to set environment variables for CGI scripts?C++ Help under UNIX
C++ new/delete not thread safe?C++ std lib help?
[转载] how to get the return value of a command by shell?How to send email in C program.
SOS!FreeBSD expert needed!Does Linux support thread?
how to delete a file with NULL name in unix? (转载)How to debug C program in Unix
Re: [转载] how to get the return value of a command by shell?How can run fortran language in Window NT?
相关话题的讨论汇总
话题: max话题: value话题: c++话题: question话题: return