I was compiling a C++ program that makes use of the C++ keyword "override".
I compiled it successfully in Visual Studio 2010, but now I need to compile it on g++. Only g++ 4.6 is available (and you need g++ 4.7 to support "override").
The real solution is to install g++ 4.7 (which is happening now), but it got me thinking. Is there a compile-time check to see if a keyword is supported?
I tried:
#ifndef override
#define override
#ifdef BUILD_WINDOWS
#pragma message("The \"override\" keyword is not supported on this compiler! Ignoring it!")
#else
#warning "The \"override\" keyword is not supported on this compiler! Ignoring it!"
#endif
#endif
This doesn't work, since "override" is not a symbol.
I would like something more general than simply checking the compiler version to see if it is one of the ones that supports the keyword. How can this be done, if at all?