Intel fortran-80 Laptop User Manual


 
FORTRAN-80
Functions And Subroutines
5.3.1 Common Blocks
Common
blocks reduce storage requirements by allowing two
or
more
subprograms
to share the same
memory.
This sharing
may
be limited by the rules for defining
and
referencing
data.
The
variables
and
arrays in a
common
block
can
be defined
and
referenced in all
subprograms
that
contain
a declaration
of
that
common
block. 'Association
is
by
memory
location
rather
than
by
name,
so the names
of
variables
and
arrays
of
a
given
common
block
may
be different in the different
subprograms.
However, the
data
referenced
and
the
common
block name used to reference the
data
must be
of
the same type.
An
integer variable
ASSIGNed
a statement label
can
only be referenced in the pro-
gram
unit containing its
ASSIGN
statement.
5.3.2 Dummy And Actual Arguments
A
dummy
argument
is
used in the
argument
list when defining a procedure.
An
ac-
tual
argument
is
used in the corresponding
argument
list when the procedure
is
referenced.
Dummy
arguments
are used by statement functions,
FUNCTION
subprograms,
and
SUBROUTINE
subprograms
to
specify the types
of
actual arguments
and
whether
the
argument
is
a single value,
array,
or
procedure.
In
the case
of
a statement func-
tion, the
dummy
argument
must be a variable.
Dummy
argument
names
can
be used anywhere
an
actual
name
of
the same 'class'
(that
is, variable,
array,
or
dummy
procedure)
and
type can be used, unless explicitly
prohibited.
Dummy
argument
names
cannot
appear
in
EQUIVALENCE,
DATA,
SA VE,
INTRINSIC,
or
COMMON
statements (except as
common
block names). A
dummy
name
also
cannot
be the same as a
FUNCTION,
SUBROUTINE,
or
state-
ment function
name
declared in the same
program
unit.
Actual
arguments
list the entities to be associated with corresponding
dummy
arguments
for a
particular
procedure
reference. Actual arguments
may
be constants,
function
or
subroutine
references,
or
expressions, including parenthesized expres-
sions (if the associated
dummy
argument
is
not defined during execution
of
the ex-
ternal procedure).
An
actual
argument
cannot
be the
name
of
a statement function
defined later in the
program
unit containing the reference.
5.3.3 Association Of Arguments
When
a
procedure
reference
is
executed, the actual
and
dummy
arguments
are
associated; the first actual
argument
replaces all occurrences
of
the first
dummy
argument,
etc.
Therefore,
the
arguments
must agree in
order,
number,
type (except
when the actual
argument
is
a
subroutine
name),
and
length (where applicable).
If
an
actual
argument
is
associated with a
dummy
appearing in
an
adjustable
dimen-
sion, the actual
argument
must be defined with
an
integer value when the
procedure
is
referenced.
If
an
actual
argument
is
an
expression, the expression
is
evaluated before associa-
tion.
If
the actual
is
an
array
element name, its subscript
is
evaluated before associa-
tion.
5-9