next up previous contents index
Next: Scope of Symbolic Names Up: Program Structure and Layout Previous: Execution Sequence

Symbolic Names

    Symbolic names can be given to items such as variables, arrays, constants, functions, subroutines, and common blocks. All symbolic names must conform to the following simple rule: the first character of each name must be a letter, this may be followed by up to five more letters or digits. Here are some examples of valid symbolic names:

 
          I  MATRIX  VOLTS  PIBY4  OLDCHI  TWOX  R2D2  OUTPUT
And here are some names which do not conform to the rules:

tabular346

It is best to avoid using digits in names unless the meaning is clear, because they are often misread. The digit 1 is easily confused with the letter I, similarly 0 looks much like the letter O on many devices.

The six-character limit on the length of a symbolic name is one of the most unsatisfactory features of Fortran: programs are much harder to understand if the names are cryptic acronyms or abbreviations, but with only six characters there is little choice. Although many systems do not enforce the limit (and Fortran90 allows names up to 31 characters long), at present the only way to ensure software portability is to keep to it strictly. There is a further problem with items which have an associated data type (constants, variables, arrays, and functions). Unless the data type is declared explicitly in a type statement, it is determined by the initial letter of the name. This may further restrict the choice.



Mario Storti
Wed Nov 4 19:32:56 ART 1998