Symbolic Names [ HP FORTRAN 77/iX Reference ] MPE/iX 5.0 Documentation
HP FORTRAN 77/iX Reference
Symbolic Names
Symbolic names define the names of any of the following:
* Main program
* Subroutine or function
* Block data subprogram
* Common block
* Named constant
* Simple variable
* Array
* Record, structure, and record field
* Namelist group-name
Symbolic names can be user-defined or predefined by FORTRAN. Each
symbolic name consists of a sequence of characters, the first of which
must be a letter. The rest can be letters, digits, the underscore
character (_), or the dollar sign ($). The underscore character and the
dollar sign in symbolic names are extensions to the ANSI 77 standard.
Letters can be uppercase or, as an extension to the ANSI 77 standard,
lowercase. The name can be any length, but only the first 32 characters
are significant. This is also an extension to the ANSI 77 standard,
because the standard permits only six characters.
Examples
FORTRAN_COMPILER_INITIALIZATION_SUBROUTINE
char_string
NumBer_of_ERRors
VAR$_1
REAL_VALUE
sum_of_real_values
error_flag
EXTERNAL_routine$
Notice that, because only the first 32 characters are significant, the
compiler considers the following to be the same name:
Character 32
|
FORTRAN_COMPILER_INITIALIZATION_SUBROUTINE
FORTRAN_COMPILER_INITIALIZATION_SUBPROGRAM
Because uppercase and lowercase letters are not distinguished in symbolic
names, the following are equivalent:
result3
RESULT3
ResulT3
NOTE Case is significant only when a letter is used in a character or
Hollerith constant.
The name that identifies a variable, named constant, or function also
identifies its default data type. A first letter of I, J, K, L, M, or N
implies type INTEGER, either INTEGER*4 (default) or INTEGER*2, depending
on the setting of the compiler directives LONG and SHORT. See "Data
Types" for more detail. Any other letter implies type REAL. This
default implied typing can be redefined with an IMPLICIT statement. It
can be overridden with an explicit type statement.
A symbolic name that identifies a main program, subroutine, block data
subprogram, or common block has no data type.
Symbolic names can be identical to keywords because the interpretation of
a sequence of characters is implied by its context. Similarly, the
symbolic name of a named constant or variable can be the same as the
symbolic name of a common block, without conflict.
The following are valid statements in FORTRAN:
Examples Notes
--------------------------------------------------------------------------------------
READ = IF + DO * REAL READ, IF, DO, and REAL are recognized as variables.
They can also be used elsewhere as keywords in
statements.
IF (IF .EQ. GOTO) GOTO 99 The IF and GOTO within the logical expression are
recognized as variables. The IF and GOTO outside
the expression are recognized as statement
keywords.
DO 10 j = 1.5 The symbol DO 10 j is recognized as a variable,
even though it contains blanks, mixed case, and the
characters DO.
Although FORTRAN permits the above examples, using them is poor
programming practice because they lessen program readability.
External Names
External names are a special type of user-defined name used by the
linker. In FORTRAN, external names are generated for subroutines,
functions, entry points, and common blocks. Unless the ALIAS or
EXTERNAL_ALIAS directive is used (refer to Chapter 7 ), the external
name is the same as the name used in the source code. A FORTRAN external
name should never conflict with the name of a system routine or
intrinsic.
FORTRAN Intrinsic Functions
FORTRAN intrinsic functions are symbolic names that are predefined by
FORTRAN. Refer to Appendix B for a list of the FORTRAN intrinsic
functions.
If a user-defined symbolic name is the same as a predefined symbolic
name, any use of that name within the same program unit refers to the
user-defined name. That is, the intrinsic function of that name is not
recognized within the program unit. (Also refer to "EXTERNAL Statement
(Nonexecutable)" .)
MPE/iX 5.0 Documentation