HP Fortran Programmer's Guide (March 2010)

Debugging
Using debugging lines
Chapter 4130
Using debugging lines
An HP Fortran program that has been written in fixed source form can contain debugging
lines. These are statements that begin with the letter D or d in column 1. When compiled with
the +dlines option, the debugging lines are treated as statements and compiled; otherwise,
they are treated as comments and ignored. A program that contains debugging lines must
also be compiled for fixed source form; that is, the filename extension must be either .f or .F,
or the program must be compiled with the +source=fixed option.
The +dlines option makes it possible to include WRITE statements as debugging lines in the
source file and to remove them from the production version of the program without having to
change source code. Instead of deleting the WRITE statements when you are ready to build the
production version, you recompile without the +dlines option, or with the +nodlines option.
Although debugging lines are supported by many implementations of Fortran (especially
FORTRAN 77), it is nonstandard and therefore nonportable. Use of this feature is even more
restrictive by reason of its being incompatible with free source form. If you try to compile a
Fortran 90 program as free source form and the program contains debugging lines, the
compilation will almost certainly fail with syntax errors.
The C preprocessor (cpp) provides a set of directives that have the same functionality as
debugging lines but are much more powerful and can be used in either fixed or free source
form. Although the cpp directives are not part of standard Fortran 90, they are available on
most UNIX systems, such as HP-UX.
The cpp directives are described in the cpp(1) man page. See the HP Fortran Programmer’s
Reference for information about the source form of HP Fortran programs and the +dlines
option.