I compiled a C ++ program that uses the C ++ keyword to override.
I compiled it successfully in Visual Studio 2010, but now I need to compile it in g ++. Only g ++ 4.6 is available (and you need g ++ 4.7 to support "overriding").
The real solution is to install g ++ 4.7 (what is happening now), but it made me think. 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 does not work because "overriding" is not a symbol.
I would like something more general than just checking the compiler version to see if this is one of those that support the keyword. How can this be done, if at all?
c ++
imallett
source share