CodeQL documentation

Futile conditional

ID: cpp/empty-if
Kind: problem
Security severity: 
Severity: recommendation
Precision: high
Tags:
   - reliability
   - readability
Query suites:
   - cpp-security-and-quality.qls

Click to see the query in the CodeQL repository

This rule finds If-statements with an empty then-branch and no else-branch. These statements are usually unimplemented skeleton code that should be implemented, or real unused code that should be removed to avoid confusion and misuse.

Recommendation

There might be missing statements in the then-branch or the expression in the condition can be rewritten without using an If-statement.

Example

//empty then and else branches, will not do anything (other than the check)
if (check(i)) {
}
  • © 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