Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Does 5.6 or 5.7 apply to block scope identifiers?
#1
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.
#2
Both Rules 5.6 and 5.7 apply to block scope.
Posted by and on behalf of the MISRA C Working Group
#3
So, code like this is non-compliant?
Code:
void f(void)
    {
    int i;
    }

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

void g(void)
    {
    int i;
    }
Posted by and on behalf of the MISRA C Working Group


Forum Jump:


Users browsing this thread: 3 Guest(s)