C ++具有一些不能用于命名变量,函数,类,名称空间等的关键字。
例如:
int类// 不行
整数运算符; // 不行
int classX; // 好的
int operatorX; // 好的
前两个适用于C。
我想知道所有的命名排除项或例外项,以便我可以警惕而不会意外使用它们。
C ++具有一些不能用于命名变量,函数,类,名称空间等的关键字。
例如:
int类// 不行
整数运算符; // 不行
int classX; // 好的
int operatorX; // 好的
前两个适用于C。
我想知道所有的命名排除项或例外项,以便我可以警惕而不会意外使用它们。
The 'forbidden names' are known as reserved words or keywords, and they are listed in a number of places, such as on cppreference.
You can also refer to the "Keywords" section of any C++ Standard; here's one draft standard that's available online (see Section #2.11).