Possible Duplicate:
or is not valid C++ : why does this code compile ?
Hello.
I’ve recently encountered unusual C++ code written by someone else:
bool operator != (Point p1, Point p2)
{
return p1.X != p2.X or p1.Y != p2.Y or p1.Z != p2.Z;
};
as far as I can tell, or isn’t declared anywhere, even as macros.
There are also few ands in the code.
As a result, project doesn’t build on VC2008 Express. Person that gave me the code said that author has been using mingw compiler.
The question: is this a non-standard compiler feature (I doubt it), is this a part of newer C++ standard (I haven’t been watching C++0x), or is this a programmer’s problem (say if the guy moved from pascal, he could have been using and/or instead of &&/|| because of habit, or because he thinks it is more “readable”).
It’s part of the C++ standard and works on all modern, conforming C++ compilers.
For Visual C++, this means passing the
/permissive-flag to the compiler, which is recommended anyway (this flag is set by default by Visual Studio 2017 and later).