← 返回首页
Use of goto — CodeQL query help documentation CodeQL docs
CodeQL documentation
CodeQL resources

Use of goto

ID: cpp/use-of-goto Kind: problem Security severity: Severity: warning Precision: high Tags: - maintainability - readability - language-features Query suites: - cpp-security-and-quality.qls

Click to see the query in the CodeQL repository

Use of goto statements makes code more difficult to understand and maintain. Consequently, the use of goto statements is deprecated except as a mechanism for breaking out of multiple nested loops, or jumping to error-handling code at the end of a function. This rule identifies complex (and therefore hard to understand) uses of goto statements. Function bodies that include multiple goto statements that jump forward and multiple goto statements that jump backwards are highlighted.

Recommendation

In most cases the code can be rewritten and/or rearranged by:

References