Predefined Preprocessor Symbols

Preprocessor symbols (macros) let you substitute values in a program before it is compiled. The substitution is performed in the preprocessing phase.

Some preprocessor symbols are predefined by the compiler system and are available to compiler directives and fpp. If you want to use others, you need to specify them on the command line.

See also Preprocessor Options.

The predefined preprocessor symbols available for the IntelŪ Fortran compiler are described in the table below. The Default column describes whether the preprocessor symbol is enabled (on) or disabled (off) by default.

Symbol Name

Default

Architecture

Description

__INTEL_COMPILER=n

On, n=800

Both

Identifies the Intel Fortran Compiler

__linux__
__linux
__gnu_linux__
linux
__unix__
__unix
unix
__ELF__

 

Both

Defined at the start of compilation

__i386__
__i386
i386

 

IA-32

 

__ia64__
__ia64
ia64

 

ItaniumŪ

 

 _OPENMP=n

n=200011

Both

This preprocessor symbol has the form YYYYMM where YYYY is the year and MM is the month of the OpenMP Fortran specification supported. This preprocessor symbol can be used in both fpp and the Fortran compiler conditional compilation. It is available only -openmp is specified.

_PRO_INSTRUMENT

Off

Both

Defined when -prof_gen is specified.

Defining Preprocessor Symbols

You can use the -D option to define the symbol names to be used during preprocessing. This option performs the same function as the #define preprocessor directive. The format of this option is:

-Dname[=value]

where:

If you do not enter a value, name is set to 1. The value should be enclosed in quotation marks if it contains spaces or special characters.

Preprocessing replaces every occurrence of name with the specified value. For example, to define a symbol called SIZE with the value 100, use the following command:

ifort -fpp -DSIZE=100 prog1.f

Preprocessing replaces all occurrences of SIZE with the specified value (100) before passing the preprocessed source code to the compiler. Assume that the program contains this declaration:

REAL VECTOR(SIZE)

In the code sent to the compiler, the value 100 replaces SIZE in this declaration, and in all other occurrences of the name SIZE.

Suppressing Preprocessor Symbols

You can use the -U option to suppress an automatic definition of a preprocessor symbol. This option suppresses any symbol definition currently in effect for the specified name. The -U option performs the same function as an #undef preprocessor directive.