I am using the newest Visual Studio 2022 and also installed the Intel C++ compiler.
When I just write a simple main() to print the values of the macros MSC_VER and __INTEL_LLVM_COMPILER,
I get
- MSC_VER = 1937, and
- __INTEL_LLVM_COMPILER = 20230200.
How is it possible that both have values defined? I must be using the wrong macros, so what's the right macro to check?
 
                        
Compilers that aim for compatibility with MSVC typically define
_MSC_VER. Similar to how compilers that support the GNU dialect of C define__GNUC__to a version number: How to tell Clang to stop pretending to be other compilers?True MSVC will definitely not define
__INTEL_LLVM_COMPILERor__llvm__, soChecking for
__llvm__should be good to exclude mainline Clang andclang-clas well as Intel's LLVM-based ICX / ICPX and/or OneAPI stuff.__INTEL_COMPILERis defined by Intel's "classic" (non-LLVM) compilers, ICC (C) and ICPC (C++).