The items in the following table can have symbolic names:
Table 1-2 Items with Symbolic Names
Symbolic constants Variables Arrays Structures @ Records @ Record fields @ |
Labeled commons Namelist groups @ Main programs Block data Subroutines Functions Entry points |
The following restrictions apply:
Symbolic names can any number of characters long. The standard is 6. @
Symbolic names consist of letters, digits, the dollar sign ($), and the underscore character (_). $ and _ are not standard. @
Symbolic names generally start with a letter--never with a digit or dollar sign ($). Names that start with an underscore (_) are allowed, but may conflict with names in the Fortran and system libraries.
Procedure names that begin with exactly two underscores are considered special support functions internal to the compiler. Avoid naming functions or subroutines with exactly two initial underscores (for example _ _xfunc) as this will conflict with the compiler's usage. @
Uppercase and lowercase are not significant; the compiler converts them all to lowercase. The -U option on the f77 command line overrides this default, thereby preserving any uppercase used in your source file. @
Example: These names are equivalent with the default in effect:
ATAD = 1.0E-6 Atad = 1.0e-6
The space character is not significant.
Example: These names are equivalent:
IF ( X .LT. ATAD ) GO TO 9 IF ( X .LT. A TAD ) GO TO 9 IF(X.LT.ATAD)GOTO9
Here are some sample symbolic names:
Valid |
Invalid |
Reason |
---|---|---|
X2 |
2X |
Starts with a digit. |
DELTA_TEMP |
_DELTA_TEMP |
Starts with an _ (reserved for the compiler). |
Y$Dot |
Y|Dot |
There is an invalid character |. |
In general, for any single program unit, different entities cannot have the same symbolic name. The exceptions are:
A variable or array can have the same name as a common block.
A field of a record can have the same name as a structure. @
A field of a record can have the same name as a field at a different level of the structure. @