Home >Backend Development >C++ >Why Does Visual Studio 2012's __cplusplus Macro Still Indicate C 98 Compatibility Despite C 11 Support?
Visual Studio 2012 __cplusplus and Its Discrepancy with C 11 Support
Despite Visual Studio 2012's advertised support for C 11, an inconsistency has been noted regarding the __cplusplus macro. Instead of reflecting the expected value of 201103L, it continues to be defined as 199711L within C projects.
Possible Explanation
The __cplusplus macro is a predefined macro that provides the version number of the C standard used by the compiler. In this specific case, the value of 199711L corresponds to the "old" C standard, which predates C 11.
Impact on C 11 Headers
Even when C 11 headers are included in the project, __cplusplus remains incorrectly defined as 199711L. This inconsistency can lead to potential issues with compatibility between the code and the C 11 standard.
Known Bug
The issue has been acknowledged by Microsoft and a bug report has been filed (A value of predefined macro __cplusplus is still 199711L). Hence, it's expected to be addressed in a future update.
The above is the detailed content of Why Does Visual Studio 2012's __cplusplus Macro Still Indicate C 98 Compatibility Despite C 11 Support?. For more information, please follow other related articles on the PHP Chinese website!