Oracle® Solaris Studio 12.4: Fortran User's Guide

Exit Print View

Updated: March 2015
 
 

3.4.9 –Dname[=def]

Define symbol name for the preprocessor.

This option only applies to .F, .F90, .F95, and .F03 source files.

–Dname=def Define name to have value def

–Dname Define name to be 1

On the command line, this option will define name as if

#define name[=def]

had appeared in the source file. If no =def specified, the name name is defined as the value 1. The macro symbol name is passed on to the preprocessor fpp (or cpp— see the -xpp option) for expansion.

The predefined macro symbols have two leading underscores. The Fortran syntax may not support the actual values of these macros—they should appear only in fpp or cpp preprocessor directives. (Note the two leading underscores.)

  • The compiler version is predefined (in hex) in _ _SUNPRO_F90, and _ _SUNPRO_F95. For example _ _SUNPRO_F95 is 0x860 for version 8.6 of the Fortran compiler in the Oracle Solaris Studio 12.4 release.

  • The following macros are predefined on appropriate systems:

    _ _sparc, _ _unix, _ _sun, _ _SVR4, __i386, _ _SunOS_5_10, _ _SunOS_5_11

    The symbols _ _sparc, _ _sparcv8, and _ _sparcv9 are defined on their respective SPARC systems.

  • The following are predefined with no underscores, but they might be deleted in a future release: sparc, unix, sun

  • On 64-bit x86 systems, the macros __amd64 and __x86_64 are defined.

Compile a .F, .F90, .F95, or .F03 source file with the -v verbose option to see the preprocessor definitions assumed by the compiler.

You can use these values in such preprocessor conditionals as the following:

#ifdef _ _sparc

f95 uses the fpp(1) preprocessor by default. Like the C preprocessor cpp(1), fpp expands source code macros and enables conditional compilation of code. Unlike cpp, fpp understands Fortran syntax, and is preferred as a Fortran preprocessor. Use the -xpp=cpp flag to force the compiler to specifically use cpp rather than fpp.