Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C Programming
Style question: (5 == x) or (x == 5)
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
Reply to thread
Message
[QUOTE="Mabden, post: 1709493"] Microsoft compilers (MSVC and VS6) only warn about "if (x=5)" if you set the warning level up to 4 (the max). Level 4 also warns about non-ANSI code and is generally a PITA. I usually use level 3, so I would not have seen a warning about this code. However "if (5=x)" will not compile even with warnings turned off. I guess Microsoft embraces the "Trust the Programmer" motto of C. }:-0 I am only starting to use this method myself, when I write in C, and I'm not totally comfortable with seeing it, but I agree with the poster who said it was worth getting used to if it saves you from one maddening debug session. Especially when it's your code and you KNOW you coded it right! ;-) [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C Programming
Style question: (5 == x) or (x == 5)
Top