MISRA Discussion Forums

Full Version: Does 5.6 or 5.7 apply to block scope identifiers?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
The rule reads:
Quote:No identifier name should be reused.

Regardless of scope, no identifier should be re-used across any files in the system. This rule incorporates the provisions of Rules 5.2, 5.3, 5.4, 5.5 and 5.6.

Does this advisory apply to block scope variables? The accompanying text says the rule incorporates the provisions of the other rules, but does not say if the rule is limited to just those provisions.

Rule 5.7 appears to constitute a stricter version of rule 5.6, which raises the question, "Does 5.6 apply to block scope variables?" as well.
Both Rules 5.6 and 5.7 apply to block scope.
So, code like this is non-compliant?
Code:
void f(void)
    {
    int i;
    }

void g(void)
    {
    int i;
    }
The following code is not compliant with advisory Rule 5.7.
Code:
void f(void)
    {
    int i;
    }

void g(void)
    {
    int i;
    }