
...
When a larger scope than necessary is used, code becomes less readable, harder to maintain, and more likely to reference unintended variables . (See see DCL01-C. Do not reuse variable names in subscopes).)
Noncompliant Code Example
...
Tool | Version | Checker | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
CodeSonar |
| LANG.STRUCT.SCOPE.FILE | Scope could be file static | ||||||
| CC2.DCL19 | Fully implemented | |||||||
LDRA tool suite |
| 25 D, 61 D, 40 S | Fully Implementedimplemented | ||||||
PRQA QA-C |
| 1504, 1505, 1531, 1532, 3210, 3218 |
...