Format statements

Unlike many Fortran implementations, FTN95 preprocesses 'constant' formats at compile-time. These 'constant' formats are as follows:

  • A FORMAT statement.

  • A format expression that is a character constant or a character constant expression.

  • A format expression that is a parameter name.

All formats which include character arrays, array elements or variables are decoded at run-time. Such non-constant formats require more extensive decoding which leads to longer execution times.

For example, the following should be avoided wherever possible:

F = '(3F10.4)'
. . .

It could be rewritten as follows:

PARAMETER (F='(3F10.4)')
. . .

so that the format specifier would be decoded at compile-time.

Note also that the colon (:) edit descriptor and tab facilities can often be used instead of a run-time format.



Copyright © 1999-2024 Silverfrost Limited