Skip to content

Commit

Permalink
COMMON: Use true nullptr in Visual Studio 2010+ and true override in …
Browse files Browse the repository at this point in the history
…VS 2012+

Those compilers support these features despite not being fully C++11-compliant.

<http://msdn.microsoft.com/en-us/library/hh567368.aspx> says that VS 2010
has "partial" support for override. I don't know what that entails and I
can't test it, so I err on the side of caution and only enable it in 2012
and up.
  • Loading branch information
SpecLad committed Sep 5, 2014
1 parent 8eb82fd commit daceff7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions common/c++11-compat.h
Expand Up @@ -32,13 +32,17 @@
// though.
//
#if !defined(nullptr) // XCode 5.0.1 has __cplusplus=199711 but defines this
#if !defined(_MSC_VER) || _MSC_VER < 1600
#define nullptr 0
#endif
#endif

//
// Replacement for the override keyword. This allows compilation of code
// which uses it, but does not feature any semantic.
//
#if !defined(_MSC_VER) || _MSC_VER < 1700
#define override
#endif

#endif

0 comments on commit daceff7

Please sign in to comment.