MISRA Discussion Forums
2-10-1 No "overlapping visibility" restriction? - Printable Version

+- MISRA Discussion Forums (https://forum.misra.org.uk)
+-- Forum: MISRA C++ (https://forum.misra.org.uk/forumdisplay.php?fid=18)
+--- Forum: MISRA C++:2008 rules (https://forum.misra.org.uk/forumdisplay.php?fid=19)
+---- Forum: 6.2 Lexical conventions (C++) (https://forum.misra.org.uk/forumdisplay.php?fid=131)
+---- Thread: 2-10-1 No "overlapping visibility" restriction? (/showthread.php?tid=1326)



2-10-1 No "overlapping visibility" restriction? - grunwald - 16-03-2017

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?

Code:
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?

Code:
class MyClass { };
MyClass myClass;  // 2-10-1 violation?



Re: 2-10-1 No "overlapping visibility" restriction? - misra cpp - 10-07-2017

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