What macro distinguishes ifort from other fortran compilers?

I work with Fortran code, which should work with various Fortran compilers (and interacts with both C ++ and Java code). We are currently working with gfortran and g95, but I'm learning what it takes to get it working with ifort, and the first problem I came across is figuring out how to determine if it uses ifort or not in the source code.

For example, I have this piece of code:

#if defined(__GFORTRAN__) // Macro to add name-mangling bits to fortran symbols. Currently for gfortran only #define MODFUNCNAME(mod,fname) __ ## mod ## _MOD_ ## fname #else // Macro to add name-mangling bits to fortran symbols. Currently for g95 only #define MODFUNCNAME(mod,fname) mod ## _MP_ ## fname #endif // if __GFORTRAN__ 

What is a macro for ifort? I tried IFORT , but it was wrong, and further guesses do not seem effective. I also tried reading the man page using ifort -help and Google.

+4
source share
2 answers

According to their docs, they define __INTEL_COMPILER = 910. 910 may be the version number, but you can probably just #ifdef on it.

I should note that ifort does not allow macros unless you explain this with the / fpp flag.

+2
source

Source: https://habr.com/ru/post/1305156/


All Articles