Possible Duplicate:
ObjectiveC: if (obj) {…} AND if (obj != nil) {…}, which is better?
Is there a difference between these two conditions:
if (!object) {
// do something
}
and . . .
if (object == nil) {
// do something
}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No, there is no difference. Both of those examples are exactly the same. From the C spec 6.5.3.3 Unary arithmetic operators:
Since
nilis 0, that last sentence applies exactly.