Do not use the same variable name in two scopes where one scope is contained in another. For example,
- No other variable should share the name of a global variable if the other variable is in a subscope of the global variable.
- A block should not declare a variable with the same name as a variable declared in any block that contains it.
...
Tool | Version | Checker | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
|
| ||||||||||
|
|
|
| ||||||||||
|
|
|
| ||||||||||
|
|
|
|
Related Vulnerabilities
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
...
Related Guidelines
CERT C++ Secure Coding Standard: DCL01-CPP. Do not reuse variable names in subscopes
Java The CERT Oracle Secure Coding Standard for Java: SCP02-J. Do not reuse names
...
\[[ISO/IEC 9899:1999|AA. Bibliography#ISO/IEC 9899-1999]\] Section 5.2.4.1, "Translation limits"
\[[MISRA 2004|AA. Bibliography#MISRA 04]\] Rule Wiki Markup
MISRA Rule 5.2
Bibliography
...