2

I want to know if my compiler supports C++11 or no, and when use the const __cplusplus to know the C++ version, I found that prints 199711.

Is this version number means that compiler supports C++11?
Note: I'm using Visual Studio 2013 v12.0.40629 Update5.

Lion King
  • 32,851
  • 25
  • 81
  • 143
  • 2
    Not a dupe of the linked question. Possibly a dupe of http://stackoverflow.com/q/14131454/1639256. – Oktalist May 29 '16 at 12:04
  • 2
    You will experience significantly more success if you check for the existence of specific language features, rather than insist upon adherence to the *entire* spec. MSVC still hasn't implemented the entirety of C++11, so they can't (shouldn't) bump the version of `__cplusplus`. – Cody Gray - on strike May 29 '16 at 12:16
  • /agree Oktalist & @CodyGray - that's exactly why I've linked https://github.com/sloede/cxx11tests & https://msdn.microsoft.com/pl-pl/library/hh567368.aspx ; IMO C++11 is *still* so broad and new-ish that many C/C++ platforms (uC/embedded included) aren't likely to support it fully *ever*. –  May 29 '16 at 13:38

1 Answers1

8

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

Community
  • 1
  • 1