C++primer中标识符问题
c++ primer第四版第二章“术语”中对标识符的定义:
identifier(标识符)
A name. Each identifier is a nonempty sequence of letters, digits, and underscores that must not begin with a digit. Identifiers are case-sensitive: Upper- and lowercase letters are distinct. Identifiers may not use C++ keywords. Identifiers may not contain two adjacent underscores nor may they begin with an underscore followed by a uppercase letter.
名字。每个标识符都是字母、数字和下划线的非空序列,且序列不能以数字开头。标识符是大小写敏感的:大写字母和小写字母含义不同。标识符不能使用C++中的关键字,不能包含相邻的下划线,也不能以下划线后跟一个大写字母开始。
///////////////////////////////////////
关于“不能包含相邻的下划线,也不能以下划线后跟一个大写字母开始。”这一句我有疑问啊,好像可以这样命名的吧。下面的程序我在DEVC++和VC6里都成功运行了。请高人指点。
#include<iostream>
using std::cout;
using std::cin;
using std::endl;
int main()
{
int a = 1;
int _a = 2;
int __a = 3;
int _ABC = 4;
int __a__ = 5;
int _____ = 6;
cout << a << endl;
cout << _a << endl;
cout << __a << endl;
cout << _ABC << endl;
cout << __a__ << endl;
cout << _____ << endl;
system("pause");
return 0;
}