Synopsis: | To avoid name collision, one shall not use the same name for different identifiers. |
Language: | C |
Severity Level: | 2 |
Category: | Concepts |
Description: |
Justification Re-declaration of identifiers results in confusing code, even if the identifiers belong to different name spaces. Using the same name may confuse the reader. Example int value; /* ... */ { float value; /* WRONG: obscures earlier 'value' */ /* ... */ } /* ... */ Note The gcc compiler option "-Wshadow" is able to check this rule. This also accounts for an identifier declared as typedef. |