The C++ Standard [[ISO/IEC 14882-2003]] Section 17.4.3.1.2, "Global names" says: "Each name that contains a double underscore (_ _) or begins with an underscore followed by an uppercase letter is reserved to the implementation for any use." Trying to use a name of this form may lead to that name conflicting with one used by the implementation, with unpredictable results that may, but may not, be detected at compile time.
Non-Compliant Code Example
In this example, an object is defined with a name that is reserved for the implementation.
int _Page_Count; // ...
Compliant Solution
To correct this error, use names not beginning with an underscore followed by an uppercase letter and not containing a double underscore.
int PageCount; // ...
Risk Assessment
Using a name reserved for the implementation may lead to unpredictable results.
Rule |
Severity |
Likelihood |
Remediation Cost |
Priority |
Level |
---|---|---|---|---|---|
DCL30-CPP |
1 (low) |
1 (unlikely) |
3 (low) |
P3 |
L3 |
References
[[ISO/IEC 14882-2003]] Section 17.4.3.1.2, "Global names"
DCL16-CPP. Use 'L', not 'l', to indicate a long value 02. Declarations and Initialization (DCL) DCL31-C. Avoid self initialization