Clicky

Fortran Wiki
Preprocessors

Introduction

Preprocessors serve multiple purposes, including conditional-compilation, macros for code simplification, and inclusion of additional source files. Fortran originally had no proper preprocessor, so it became common to use cpp. However, cpp is not fully compatible with Fortran source, so Sun developed fpp, a Fortran-compatible version of cpp. Around the same time, Fortran 95 defined an optional conditional-compilation preprocessor, called coco.

Today, fpp is essentially the de facto standard Fortran preprocessor, although some compilers still invoke cpp in traditional mode. Compilers that support cpp or fpp usually support Predefined preprocessor macros that aid compiler-specific code requirements. Although coco is an official standard, it is generally not supported directly by Fortran compilers, and therefore loses the benefit of compiler-defined preprocessor tokens.

Fortran-Specific Preprocessors

Other Preprocessors

See Also