tkem / fsmlite

Lightweight finite state machine framework for C++11
MIT License
161 stars 25 forks source link

Additionally use _MSVC_LANG for determining the C++ language version #33

Closed tkem closed 3 years ago

tkem commented 3 years ago

MSVC requires /Zc:__cplusplus to correctly set __cplusplus: https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/ However, there is also _MSVC_LANG:

_MSVC_LANG Defined as an integer literal that specifies the C++ language standard targeted by the compiler. It's set only in code compiled as C++. The macro is the integer literal value 201402L by default, or when the /std:c++14 compiler option is specified. The macro is set to 201703L if the /std:c++17 compiler option is specified. It's set to a higher, unspecified value when the /std:c++latest option is specified. Otherwise, the macro is undefined. The _MSVC_LANG macro and /std (Specify Language Standard Version) compiler options are available beginning in Visual Studio 2015 Update 3. https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=msvc-160

Consider checking for specific C++ versions/features using both __cplusplus and _MSVC_LANG, so users do not have to remember turning on /Zc:__cplusplus.