Visual Studio 2012 _Cplusplus and C++ 11

Visual Studio 2012 __cplusplus and C++ 11

This has already been submitted to Microsoft for review:

A value of predefined macro __cplusplus is still 199711L

C++11 features in Visual Studio 2012

It's worth noting that Visual Studio 2010 already had quite a bit of early C++11 support. So to summarize what is already linked to in other answers, here is what is new in Visual Studio 11 that was not part of Visual Studio 2010:

  • rvalue references to version 2.1 from 2.0
  • lambdas to version 1.1 from 1.0.
  • decltype to version 1.1 from 1.0(not yet available in developer preview)
  • Improved, but still incomplete, Alignment
  • completed strongly-typed enums
  • forward declared enums
  • Standard layout and trivial types
  • Atomics
  • Strong compare and exchange
  • Bi-directional fences
  • Data-dependency ordering
  • Range-based for loop

In early November 2012, Microsoft announced the Visual C++ Compiler November 2012 CTP, which adds more C++11 functionality to Visual Studio 2012:

  • uniform initialization
  • initializer lists
  • variadic templates
  • function template default arguments
  • delegating constructors
  • explicit conversion operators
  • raw strings

Know which version of c++ is running on Visual Studio

According to this question: Visual Studio 2012 __cplusplus and C++ 11 , provided by @paddy, this is a known bug with MSVC in that the version macro is set to C++98. You should compile with the /Zc:__cplusplus switch to change the version macro to the correct value.

__cplusplus is equal to 199711 in MSVC, does it support C++11?

It's an issue with MSVC (i.e. with its lacking C++11/C++14 support):

https://connect.microsoft.com/VisualStudio/feedback/details/763051/a-value-of-predefined-macro-cplusplus-is-still-199711l

so no, this value doesn't mean anything specific as far as MSVC is concerned. Some C++11 features will work flawlessly, some will fail. Because of that, this C++99-ish value has some sense in it; your best bet is to check for specific features (see cxx11tests link below) instead.

Further info:

C++11 on Windows

https://msdn.microsoft.com/pl-pl/library/hh567368.aspx

https://stackoverflow.com/a/27459246/719662

How to Detect if I'm Compiling Code With Visual Studio 2008?

https://github.com/sloede/cxx11tests

No C++11 on vs 2015 pro?

Include the header <string>



Related Topics



Leave a reply



Submit