CodeQL documentation

Continue statement that does not continue

ID: cpp/continue-in-false-loop
Kind: problem
Security severity: 
Severity: warning
Precision: high
Tags:
   - correctness
Query suites:
   - cpp-security-and-quality.qls

Click to see the query in the CodeQL repository

A continue statement only re-runs the loop if the loop condition is true. Therefore using continue in a loop with a constant false condition will never cause the loop body to be re-run, which is misleading.

Recommendation

Replace the continue statement with a break statement if the intent is to break from the loop.

References

  • © GitHub, Inc.
  • Terms
  • Privacy
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy