为什么人们在C ++中使用__(双下划线)
我在看看一些开源的C ++代码,并注意到在代码中使用的很多double,主要是在变量名的开头。
I was having a look through some open source C++ code and notice a lot of double under scores where used in the code, mainly at the start of variable names.
return __CYGWIN__;
只是想知道是有原因的,还是只是一些人的代码样式?我认为我很难阅读。
Just wondering is there a reason for this, or is it just some people code styles? I would think that I makes it hard to read.
标识符中两个下划线(`__')的使用是为编译器根据ANSI-C标准内部使用而保留的。
The use of two underscores (`__') in identifiers is reserved for the compiler's internal use according to the ANSI-C standard.
)通常用在库函数的名称中(例如_main和_exit)。为避免冲突,请勿使用下划线开始标识符。
Underscores (`_') are often used in names of library functions (such as "_main" and "_exit"). In order to avoid collisions, do not begin an identifier with an underscore.