What are the conventions for __func functions?

試著忘記壹切 提交于 2019-12-08 07:50:28

问题


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?


回答1:


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:

  • What are the rules about using an underscore in a C++ identifier?
  • What does a double underscore mean in a variable name in the C language?
  • Why do people use __(double underscore) so much in C++


来源:https://stackoverflow.com/questions/10477458/what-are-the-conventions-for-func-functions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!