Possible Duplicate:
Is there a difference between i==0 and 0==i?
What’s the benefit of the following coding styles , is there any difference between them ?
int i;
// more code
if (i == 0) {...}
vs
if (0 == i) {...}
Thanks
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 difference, pick one and stick with it for consistency. The
(value == variable)is a relic from older languages where you could accidentally assign a value to a variable in an if(a = 0), instead of(a == 0)They will both turn into (effectively) the same machine instruction, so there won’t be any performance difference at all