<!DOCTYPE qhelp PUBLIC
  "-//Semmle//qhelp//EN"
  "qhelp.dtd">
<qhelp>


<overview>
<p>
This rule finds expressions without side effects (i.e. changing variable values) that are used in a context where their value is ignored.
These expressions are most likely intended to be part of a condition but were coded improperly.
</p>

<p>
In most cases these are defects caused by the unintended use of the comma operator. It is easy to 
misuse the comma operator (particularly in conditions)
and it would be good practice to use it only when the brevity it allows is absolutely necessary (e.g. macro definitions).
</p>

</overview>
<recommendation>
<p>
Make sure that the flagged expressions are not oversights. 
To document that the value of the expression is deliberately ignored, you could explicitly cast it to <code>void</code>.
</p>

</recommendation>
<example><sample src="ExprHasNoEffect.cpp" />

</example>
<references>

<li>
  Tutorialspoint - The C++ Programming Language: <a href="http://www.tutorialspoint.com/cplusplus/cpp_comma_operator.htm">C++ Comma Operator</a>
</li>





</references>
</qhelp>
