Movatterモバイル変換


[0]ホーム

URL:


CodeQL documentation
CodeQL resources

Futile conditional

ID: cpp/empty-ifKind: problemSecurity severity: Severity: recommendationPrecision: highTags:   - reliability   - readabilityQuery 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)){}

[8]ページ先頭

©2009-2025 Movatter.jp