1.5 Coding Rules

Coding rules specify the structure of lines in Fortran source code. A line has four fields: the statement label, continuation indicator, statement, and sequence number. Rules affecting individual fields are described in Sections 1.5.3, 1.5.4, 1.5.5, and 1.5.6.

You can code a line by using the fixed-format method (convenient when you punch cards or use a coding form) or the tab-format method (convenient when you enter lines at a terminal with a text editor).

Some Fortran compilers use blanks to pad short source lines out to 72 characters. By default, Compaq Fortran 77 does not. However, you can specify compiler option PAD_SOURCE to get this effect.

Compaq Fortran 77's default behavior does not normally cause portability problems. However, when long character or Hollerith constants are continued across lines, portability problems can occur.

Use the concatenation operator to avoid such problems. For example:

       PRINT *, 'This is a very long character constant '//
      +         'which is safely continued across lines'

Use this same method when initializing data with long character or Hollerith constants. For example:

       CHARACTER*(*) LONG_CONS
       PARAMETER (LONG_CONS = 'This is a very long '//
      + 'character constant which is safely continued '//
      + 'across lines')
       CHARACTER*100 LONG_VAL
       DATA LONG_VAL /LONG_CONS/

For More Information:


Previous Page Next Page Table of Contents