Reputation: 4053
I've seen a bunch of functions in Linux code named __foo. What does the double underscore stand for and when should it be used?
Upvotes: 1
Views: 310
Reputation: 42153
It means it's a reserved identifer. Both C++ 03 and C99 standard mentioned about this.
C99:
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.
C++ 03:
Each name that contains a double underscore (_ _) or begins with an underscore followed by an uppercase letter (2.11) is reserved to the implementation for any use.
You can also refer to:
Upvotes: 5