替代令牌有效 c++ 关键字,但在 Visual Studio 2013 中,以下内容会发出编译错误(未声明的标识符):
Alternative tokens are valid c++ keywords, yet in Visual Studio 2013 the following emits a compilation error (undeclared identifier):
int main(int argc, const char* argv[])
{
int k(1), l(2);
if (k and l) cout << "both non zero
";
return 0;
}
既然and or not 已经存在了很长一段时间,是否有理由不实施它们?
Since and or not have been around for quite some time, is there a reason for not implementing them?
您询问基本原理.这是一个可能的原因,不一定是对 Visual C++ 团队影响最大的原因:
You ask about the rationale. Here's one possible reason, not necessarily the one that most influenced the Visual C++ team:
/permissive- 或 /Za 以实现最大的一致性,这将导致它们被视为关键字./Ze 中的关键字的解决方法是简单且可移植的.(G++ 的解决方法 -fno-operator-names 也不错,但是将选项放在源代码中而不是构建系统中会更好一些.)/permissive- or /Za for maximum conformance anyway, which will cause these to be treated as keywords./Ze by including a header file is easy and portable. (G++'s workaround -fno-operator-names isn't bad either, but putting the option in the source code rather than the build system is somewhat nicer.)这篇关于为什么 VS 不为逻辑运算符定义替代标记?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
读取输入文件,最快的方法?read input files, fastest way possible?(读取输入文件,最快的方法?)
在 C++ 中读取格式化输入的最简单方法?The easiest way to read formatted input in C++?(在 C++ 中读取格式化输入的最简单方法?)
从 .txt 文件读取到 C++ 中的二维数组Reading from .txt file into two dimensional array in c++(从 .txt 文件读取到 C++ 中的二维数组)
如何在 C++ 中模拟按键按下How to simulate a key press in C++(如何在 C++ 中模拟按键按下)
为什么在 cin.ignore() 之后没有 getline(cin, var) 读取Why doesn#39;t getline(cin, var) after cin.ignore() read the first character of the string?(为什么在 cin.ignore() 之后没有 getline(cin, var) 读取
scanf 格式输入的 cin 类比是什么?What is the cin analougus of scanf formatted input?(scanf 格式输入的 cin 类比是什么?)