C标识符
发布时间:2020-12-16 10:31:58 所属栏目:百科 来源:网络整理
导读:C Primer说: The identifier we define in our programs may not contain 2 consecutive underscores,nor can identifier begin with an underscore followed immediately by an uppercase letter. In addition,identifiers be fined outside of a function
C Primer说:
一切都很好,但是 int _c = 55; // outside function starts with _ int main () { int _A = 12; // _ followed by uppercase letter cout << _A << endl; int __b__ =33; // 2 consecutive __ cout << __b__ << endl; cout << _c << endl; } 上面的代码使用以下标志在mac,g 4.7.1上编译完全正常 g++ -pedantic -Wall -Werror -std=c++11 -O3 -funroll-loops -fprefetch-loop-arrays 我错过了什么? 解决方法
没有.带有前导下划线后跟大写字母和带有两个下划线的标识符的标识符仅保留.
您的编译器供应商可能决定随时使用它们(例如,编译器供应商使用_A作为关键字非常好),因此您不应该使用它们.通常,标准库是使用保留标识符实现的,因此它们不会导致编译错误. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |