Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: wrapped to functions

...

Exceptionally, it is permitted to use the assignment operator in conditional expressions when the assignment is not the controlling expression (that is, the assignment is a subexpression), as shown in the following compliant example:

Code Block
bgColor#ccccff
public void app_ex(BufferedReader reader) throws IOException{
	String line;
BufferedReader reader = // Initialize
while ((line = reader.readLine()) != null) {
    	// ... work with line
    }
}

Related Guidelines

ISO/IEC TR 24772:2013

Likely Incorrect Expression [KOA]

MITRE CWE

CWE-480, Use of incorrect operator

...