Conversation started Mar 29, 2014 at 1:31.
Mar 29, 2014 01:31
Hi, Programmers, new Code Review mod here. Would you accept this question for migration from CR to Programmers?
2
Q: Coding style preference if (aPtr), if (aPtr != NULL), or if (NULL != aPtr)

R SahuFirst of all, I am not sure whether this question is appropriate for this forum. If not, please let me know. I'll be glad to remove the post. I understand that as far as the compiler is concerned, the following lines are equivalent. if (aPtr) {...} if (aPtr != NULL) {...} if (NULL != aPtr) {......

user55340
@200_success I'm fairly sure it would get closed as primarily opinion.
user55340
Or a dup of...
user55340
23
Q: if ('constant' == $variable) vs. if ($variable == 'constant')

Tom AugerLately, I've been working a lot in PHP and specifically within the WordPress framework. I'm noticing a lot of code in the form of: if ( 1 == $options['postlink'] ) Where I would have expected to see: if ( $options['postlink'] == 1 ) Is this a convention found in certain languages / framewor...

Well, you didn't close that precedent as opinion. =)
Might C/C++ be sufficiently different to justify a separate question?
user55340
9
Q: In C and C++, what methods can prevent accidental use of the assignment(=) where equivalence(==) is needed?

DeveloperDonIn C and C++, it is very easy to write the following code with a serious error. char responseChar = getchar(); int confirmExit = 'y' == tolower(responseChar); if (confirmExit = 1) { exit(0); } The error is that the if statement should have been: if (confirmExit == 1) As coded, it will e...

user55340
Mar 29, 2014 01:35
Or...
user55340
29
Q: Doesn't "if (0 == value) ..." do more harm than good?

mojubaThis is one of the things that I hate most when I see it in someone else's code. I know what it means and why some people do it this way ("what if I accidentally put '=' instead?"). For me it's very much like when a child goes down the stairs counting the steps out loud. Anyway, here are my argu...

I'll note those links on the question, then close the question on our site then. Thanks!
user55340
@200_success Probably for the best.
user55340
user55340
Mar 29, 2014 01:39
Thats probably the one you want to link to as it is a link to all the questions which are linked to the main dup.
 
Conversation ended Mar 29, 2014 at 1:39.