From 0b97d585480e973d8b149618901f7a4ddfa1a906 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Sun, 8 Aug 2021 16:29:01 -0700 Subject: compilers/c++: Add MSVC option to make the __cplusplus define accurate Otherwise it always returns the value for c++98, starting with MSVC 2017 15.7 or later. Earlier versions are not affected by this mis-feature --- docs/markdown/snippets/msvc_cplusplus_define.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 docs/markdown/snippets/msvc_cplusplus_define.md (limited to 'docs/markdown') diff --git a/docs/markdown/snippets/msvc_cplusplus_define.md b/docs/markdown/snippets/msvc_cplusplus_define.md new file mode 100644 index 0000000..eabfbe8 --- /dev/null +++ b/docs/markdown/snippets/msvc_cplusplus_define.md @@ -0,0 +1,7 @@ +## MSVC now sets the __cplusplus #define accurately + +For reasons, MSVC will always return `199711L` for `__cplusplus`, even when a +newer c++ standard is explicitly requested, unless you pass a specific option to +the compiler for MSVC 2017 15.7 and newer. Older versions are unaffected by +this. Meson now always sets the option if it is available, as it is unlikley +that users want the default behavior. -- cgit v1.1