That used to be the case, yes. Of course, nowadays almost all compilers warn about assignments in if()
conditions, so the advantage is only there for people who routinely suppress warnings.
More Related Contents:
- “std::endl” vs “\n”
- #pragma once vs include guards? [duplicate]
- return statement vs exit() in main()
- What open source C++ static analysis tools are available? [closed]
- Is pass-by-value a reasonable default in C++11?
- Correct way of declaring pointer variables in C/C++ [closed]
- What is the most effective way to get the index of an iterator of an std::vector?
- int vs const int& [closed]
- Is calling destructor manually always a sign of bad design?
- Is it a good practice to place C++ definitions in header files?
- A free tool to check C/C++ source code against a set of coding standards? [closed]
- Using “super” in C++
- How do I get the index of an iterator of an std::vector?
- Checking for NULL pointer in C/C++ [closed]
- C++ getters/setters coding style
- Tools to find included headers which are unused? [closed]
- How to check for equals? (0 == i) or (i == 0) [closed]
- When should you use the “this” keyword in C++? [duplicate]
- Why use prefixes on member variables in C++ classes
- Iterate through a C++ Vector using a ‘for’ loop
- What are your favorite C++ Coding Style idioms [closed]
- What is the best way to do input validation in C++ with cin?
- Infinite loops – top or bottom? [closed]
- How can I avoid including class implementation files?
- In C++, is it still bad practice to return a vector from a function?
- Isn’t the const modifier here unnecessary? [duplicate]
- Default parameters with C++ constructors [closed]
- c++ standard practice: virtual interface classes vs. templates
- What is the difference between if (NULL == pointer) vs if (pointer == NULL)?
- #ifdef vs #if – which is better/safer as a method for enabling/disabling compilation of particular sections of code?