- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What are the rules about using an underscore in a C++ identifier?
From MSDN docs −
Use of two sequential underscore characters ( __ ) at the beginning of an identifier, or a single leading underscore followed by a capital letter, is reserved for C++ implementations in all scopes. You should avoid using one leading underscore followed by a lowercase letter for names with file scope because of possible conflicts with current or future reserved identifiers.
So you should avoid using names like −
__foo, __FOO, _FOO
And names like the following should not be used in the global namespace −
Other than this, there are some more prefixes like LC_, SIG_, and suffixes like _t should not be used as they're also reserved for the implementation.
So you can create variables that contain the underscore between the name or ends with an underscore.
- What is an identifier and its rules in C language?
- What are the principles of security identifier?
- What are the differences between lodash and underscore?
- What is an identifier in C language?
- What are the rules of Attribute Generalization?
- What are the rules to create a constructor in java?
- What are the rules for a functional interface in Java?
- What are the rules to be followed while using varargs in java?
- What are the rules for private methods in an interface in Java 9?
- What are the ways to include style sheet rules in an HTML document
- Write about Mergers & Acquisition percentage rules
- What are the identity rules for regular expression?
- What are the rules of web usage mining?
- What are the myths about Dimensional Modeling?
- What are the rules to declare variables in C++?