I've seen this in countless C/C++ header and source files.
Apart from personal preference, what's the meaning of each of these different notations?
_NAME__NAME_NAME___NAME__NAME_tQuite honestly, the only one I comprehend is _NAME, which is a private member of a class (at least in C# it is).
Can someone explain the difference among them?
And if there are any other noticeable notations as such, please mention them (even in other similar languages).
Thanks!
Names that begin with _ or __ are typically for reserved identifiers, and you should not define/create identifiers that begin with that convention. (_ with Upper Case following)
From C99 standard, 7.1.3 - "Reserved Identifiers"
— All identifiers that begin with an underscore and either an uppercase letter or another underscore are always reserved for any use.
— All identifiers that begin with an underscore are always reserved for use as identifiers with file scope in both the ordinary and tag name spaces.
From C++03 Standard (amendment to C++98), section 17.4.3.1.2 - "Global Names"
— Each name that contains a double underscore (_ _) or begins with an underscore followed by an upper- case letter (2.11) is reserved to the implementation for any use.
— Each name that begins with an underscore is reserved to the implementation for use as a name in the global namespace
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With