Using 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 to fpp. If you want to use others, you need to specify them on the command line.

You can use the -D (Linux* OS and Mac OS* X) or /D (Windows* OS) option to define the symbol names to be used during preprocessing. This option performs the same function as the #define preprocessor directive.

For more information, see the following topic:

Preprocessing with fpp replaces every occurrence of the defined symbol name with the specified value. Preprocessing compiler directives only allow IF and IF DEFINED.

If you want to disable symbol replacement (also known as macro expansion) during the preprocessor step, you can specify the following: -fpp:"-macro=no" (Linux OS and Mac OS X or /fpp:"/macro=no" (Windows OS).

Disabling preprocessor symbol replacement is useful for running fpp to perform conditional compilation (using #ifdef, etc.) without replacement.

You can use the -U (Linux OS and Mac OS X) or /U (Windows OS) option to suppress an automatic definition of a preprocessor symbol. This option suppresses any symbol definition currently in effect for the specified name. This option performs the same function as an #undef preprocessor directive.

For more information, see the following topic:

Windows OS:

The following information applies to Windows operating systems.

In addition to specifying preprocessor symbols on the command line, you can also specify them in the Visual Studio* integrated development environment (IDE). To do this, select Project>Properties and use the Preprocessor Definitions item in the General Options or Preprocessor Options category.

The following preprocessor symbols are available:

Windows* OS Predefined Symbol Name and Value

Conditions When this Symbol is Defined

__INTEL_COMPILER=1200

Identifies the Intel Fortran compiler

__INTEL_COMPILER_BUILD_DATE=YYYYMMDD

Identifies the Intel Fortran compiler build date

_DLL=1

Defined only if /libs:dll, /MDs, /MD, /dll, or /LD is specified, but not when /libs:static is specified

_MT=1

Defined only if /threads or /MT is specified

_M_IX86=n00

Only for systems based on IA-32 architecture; n is the number specified for /G (for example, _M_IX86=700 for /G7)

_M_X64

Only for systems based on Intel® 64 architecture. For use in conditionalizing applications for the Intel® 64 platform.

_M_AMD64

Only for systems based on Intel® 64 architecture. This symbol is set by default.

_OPENMP=200805

Valid when OpenMP processing has been requested (that is, when /Qopenmp is specified) Takes the form YYYYMM where YYYY is the year and MM is the month of the OpenMP Fortran specification supported. This symbol can be used in both fpp and the Fortran compiler conditional compilations.

_PGO_INSTRUMENT

Defined if /Qprof_gen is specified

_WIN32

Always defined

_WIN64

Only for systems based on Intel® 64 architecture

_VF_VER=1110

Valid when Compaq* Visual Fortran-compatible compile commands (df or f90) are used

Linux OS and Mac OS X:

The following information applies to Linux OS and Mac OS X systems.

Unless otherwise specified, the symbols apply to all architectures.

Linux* OS/Mac OS* X Symbol Name

Description

__INTEL_COMPILER=n

Identifies the Intel Fortran Compiler

Default: On, n=1200

__INTEL_COMPILER_BUILD_DATE

=YYYYMMDD

Identifies the Intel Fortran Compiler build date

__linux__ (Linux only)

__linux (Linux only)

__gnu_linux__ (Linux only)

linux (Linux only)

__unix__ (Linux only)

__unix (Linux only)

unix (Linux only)

__ELF__ (Linux only)

Defined at the start of compilation

__APPLE__ (Mac OS X only)

__MACH__ (Mac OS X only)

Defined at the start of compilation

Architecture: IA-32 only

__i386__

__i386

i386

Identifies the architecture for the target hardware for which programs are being compiled

Architecture: IA-32 only

__x86_64

__x86_64__

Identifies the architecture for the target hardware for which programs are being compiled.

Architecture: Intel® 64 only

_OPENMP=n

Takes 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 when -openmp is specified.

Default: n=200805

_PGO_INSTRUMENT

Defined when -prof-gen is specified.

Default: OFF

__PIC__

__pic__

Set if the code was requested to be compiled as position independent code. On Mac OS X, these symbols are always set.

Default: Off for Linux OS; On for Mac OS X


Submit feedback on this help topic

Copyright © 1996-2010, Intel Corporation. All rights reserved.