mercredi 26 avril 2017

It it save to use _MSVC_LANG instead of __cplusplus?

I am trying to compile a multiplatform C++ project with the Microsoft Visual C++ compiler (formerly the GCC was used, among other compilers).

Now I come across some preprocessor directives like this one:

#if __cplusplus < 201103L
    // Define some macros of C++11 the code really relies on.
    // [...]
#endif

Although I use Visual Studio 2015, __cplusplus is still defined as 199711L. This post from the Microsoft blog advises to check for _MSVC_LANG instead.

To what extent does _MSVC_LANG >= 201402L not comply with C++11 ?

Aucun commentaire:

Enregistrer un commentaire