Fortran Keywords used for Symbols

| SimCon Home | fpt Reference Manual Home |

Can Fortran Keywords be Used for Symbols?

Yes they can. There are no reserved words in Fortran.

Does this cause a problem?

In our Fortran library, which contains many millions of lines of code, we have never encountered a situation where a program runs incorrectly because a keyword has been used for a variable name. However this can cause problems in maintenance. The code can be difficult to read, and try searching for a variable called "IF" with a text editor.

The fpt Report

fpt always lists the keywords used for symbols in the listing file. It also writes this list in response to the command:

SHOW KEYWORDS USED FOR SYMBOLS

The beginning of the listing for the weather and climate code, WRFV3.4.1 is shown below. Just under a thousand variables have the same names as Fortran keywords.

Check of Usage of Keywords and Intrinsic Names ============================================== (fpt command: show keywords used for symbols) FORTRAN Keywords used for identifiers ------------------------------------- Name Scope Use/COMMON Address Type Size Value/Bounds ---- ----- ---------- ------- ---- ---- ------------ real module_fr_sfire_driver%fire_ignition_convert Local LOGICAL *4 df dimension wrf_data%wrf_data_handle Type Component INTEGER *4 df (1:4) global module_configure%wrf_alt_nml_obsolete Local LOGICAL *4 df map module_mp_morr_two_moment Private:module_mp_morr_two_moment REAL *4 df data wrf_quilt_put_var_td_char Formal Input Argument REAL *4 df data wrf_quilt_get_var_td_char Formal Input Argument REAL *4 df data wrf_quilt_put_var_td_logical Formal Input Argument REAL *4 df data wrf_quilt_get_var_td_logical Formal Input Argument REAL *4 df

Copyright ©1995 to 2024 Software Validation Ltd. All rights reserved.