[c++11] MSVC does not define __cplusplus?
Hi, I encountered that '__cplusplus < 201103L' evaluates on MSVC (14.0 ...) to true?! At least on GCC + CLANG this test works - what about MSVC? best regards, Oliver
On Sat, Feb 7, 2015 at 12:47 AM, Oliver Kowalke <oliver.kowalke@gmail.com> wrote:
Hi,
I encountered that '__cplusplus < 201103L' evaluates on MSVC (14.0 ...) to true?! At least on GCC + CLANG this test works - what about MSVC?
Compilers tend to define that when they think they are fully compliant with a particular version of the standard. Even if you invoke them in the latest standards modes. You can see that from the Predef test results < http://www.boost.org/development/tests/develop/developer/predef.html>. For example VS 2015 defines it as: BOOST_LANG_STDCPP = 271100001 (27,11,1) | Standard C++ Which is still C++98. And some of the compilers that define it for C++11 define it at various month times in the year (some January some March). And some, like Intel, just define at 1. -- -- Rene Rivera -- Grafik - Don't Assume Anything -- Robot Dreams - http://robot-dreams.net -- rrivera/acm.org (msn) - grafikrobot/aim,yahoo,skype,efnet,gmail
On 7 Feb 2015 at 7:47, Oliver Kowalke wrote:
I encountered that '__cplusplus < 201103L' evaluates on MSVC (14.0 ...) to true?! At least on GCC + CLANG this test works - what about MSVC?
__cplusplus is fairly useless except for detecting a C++ compiler. You'll need to use feature detection e.g. https://github.com/ned14/Boost.BindLib/blob/master/include/cpp_feature .h or https://github.com/ned14/Boost.BindLib/blob/master/include/boost/confi g.hpp if you prefer the Boost named macros. Niall -- ned Productions Limited Consulting http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/
2015-02-07 17:13 GMT+01:00 Niall Douglas <s_sourceforge@nedprod.com>:
__cplusplus is fairly useless except for detecting a C++ compiler.
hmmm - I thought that 201103L indicates an complete C++11 feature set
You'll need to use feature detection e.g. https://github.com/ned14/Boost.BindLib/blob/master/include/cpp_feature .h or https://github.com/ned14/Boost.BindLib/blob/master/include/boost/confi g.hpp if you prefer the Boost named macros.
which feature is responsible for parameter expansion in lambdas? so far I test for BOOST_NO_CXX11_LAMBDAS, BOOST_NO_CXX11_VARIADIC_TEMPLATES and BOOST_NO_CXX11_VARIADIC_MACROS (beside of others) Oliver
On 07/02/2015 19:34, Oliver Kowalke wrote:
2015-02-07 17:13 GMT+01:00 Niall Douglas <s_sourceforge@nedprod.com>:
__cplusplus is fairly useless except for detecting a C++ compiler.
hmmm - I thought that 201103L indicates an complete C++11 feature set
No Visual C++ revision has a complete C+11 feature set anyway.
participants (4)
-
Mathias Gaunard
-
Niall Douglas
-
Oliver Kowalke
-
Rene Rivera