MISRA Discussion Forums

Full Version: 2-10-1 No "overlapping visibility" restriction?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
C 2012 Directive 4.5: "Identifiers in the same name space with overlapping visibility should be typographically unambiguous"
C++ Rule 2-10-1: "Different identifiers shall be typographically unambiguous."

Does this mean the C++ rule applies even to identifiers in different scopes?

void f1() { int i; }
void f2() { int I; } // 2-10-1 violation due to only differing in case?

Also, does the C++ rule forbid naming a variables after their class name?

class MyClass { };
MyClass myClass;  // 2-10-1 violation?
Uses of i and I in different scopes are non-compliant as is MyClass myClass

We are considering adopting the C12 directive for the next version