Files
codeql/cpp/ql/src/Likely Bugs/ContinueInFalseLoop.qhelp
2019-07-11 20:00:50 +01:00

25 lines
703 B
XML

<!DOCTYPE qhelp PUBLIC
"-//Semmle//qhelp//EN"
"qhelp.dtd">
<qhelp>
<overview>
<p>A <code>continue</code> statement only re-runs the loop if the loop condition is true. Therefore using <code>continue</code> in a loop with a constant false condition will never cause the loop body to be re-run, which is misleading.
</p>
</overview>
<recommendation>
<p>Replace the <code>continue</code> statement with a <code>break</code> statement if the intent is to break from the loop.
</p>
</recommendation>
<references>
<li>
Tutorialspoint - C Programming Language: <a href="https://www.tutorialspoint.com/cprogramming/c_continue_statement.htm">Continue Statement in C</a>.
</li>
</references>
</qhelp>