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\n";
return 0;
}
Since and or not
have been around for quite some time, is there a reason for not implementing them?
Best Answer
You ask about the rationale. Here's one possible reason, not necessarily the one that most influenced the Visual C++ team:
/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.)