Specifies the intended use of one or more dummy arguments.
The INTENT attribute can be specified in a type declaration
statement or an INTENT statement, and takes one of the following
forms:
Type Declaration Statement:
type, [att-ls,] INTENT (spec) [,att-ls] :: d [, d]...
Statement:
INTENT (spec) [::] d [, d]...
type Is a data type specifier.
att-ls Is an optional list of attribute specifiers.
spec Is one of the following specifiers:
IN Specifies that the dummy argument must
not be redefined (or become undefined)
during execution of the procedure.
Any associated actual argument must be
an expression.
OUT Specifies that the dummy argument must be
defined before it is referenced in the
procedure.
Any associated actual argument must be
definable. The argument becomes undefined
on entry to the procedure, and is intended
only to pass information out of the procedure.
INOUT Specifies that the dummy argument can both
receive data from and return data to the
calling program unit.
Any associated actual argument must be
definable.
d Is the name of a dummy argument. It cannot
be a dummy procedure or dummy pointer.
If no INTENT attribute is specified for a dummy argument, its use
is subject to the limitations of the associated actual argument.
If a function specifies a defined operator, the dummy arguments
must have intent IN.
If a subroutine specifies defined assignment, the first argument
must have intent OUT or INOUT, and the second argument must have
intent IN.
If an actual argument is an array section with a vector subscript,
it cannot be associated with a dummy array that is defined or
redefined (has intent OUT or INOUT).
The INTENT attribute is compatible with the DIMENSION, OPTIONAL,
TARGET, and VOLATILE attributes.
EXAMPLES:
The following example shows type declaration statements specifying
the INTENT attribute:
SUBROUTINE TEST(I, J)
INTEGER, INTENT(IN) :: I
INTEGER, INTENT(OUT), DIMENSION(I) :: J
The following are examples of the INTENT statement:
SUBROUTINE TEST(A, B, X)
INTENT(INOUT) :: A, B
...
SUBROUTINE CHANGE(FROM, TO)
USE EMPLOYEE_MODULE
TYPE(EMPLOYEE) FROM, TO
INTENT(IN) FROM
INTENT(OUT) TO
...