HP Fortran Programmer's Reference (September 2007)

HP Fortran statements
INTENT (statement and attribute)
Chapter 10 389
If a dummy argument has intent OUT, the corresponding actual argument must be definable;
that is, it cannot be a constant. When execution of the procedure begins, the dummy
argument is undefined; thus it must be given a value before it is referenced. The dummy
argument need not be given a value by the procedure.
If a dummy argument has intent INOUT, the corresponding actual argument must be
definable. If the actual argument is defined, this value is passed in as the value of the dummy
argument. The dummy argument need not be given a value by the procedure.
The following points should also be noted:
Intent specifications apply only to dummy arguments and may only appear in the
specification part of a subprogram or interface body.
If there is no intent specified for an argument in a subprogram, the limitations imposed
by the actual argument apply to the dummy argument. For example, if the actual
argument is an expression that is not a variable, the dummy argument must not redefine
its value.
The intent of a pointer dummy argument must not be specified.
Examples
! x, y, and z are dummy arguments
SUBROUTINE electric (x, y, z)
REAL, INTENT (IN) :: x, y ! x and y are used only for input
! z is used for input and output
COMPLEX, INTENT (INOUT), TARGET :: z(1000)
...
SUBROUTINE pressure (true, tape, a, b)
USE a_module
TYPE(ace), INTENT(IN) :: a, b ! a and b are only for input
INTENT (OUT) true, tape ! true and tape are for output
...
SUBROUTINE lab_ten (degrees, x, y, z)
COMPLEX, INTENT(INOUT) :: degrees
REAL, INTENT(IN), OPTIONAL :: x, y
INTENT(IN) z
...
PROGRAM pxx
CALL electric (a+1, h*c, d) ! First subroutine defined above
CALL lab_ten (dg, e, f, g+1.0)
END PROGRAM pxx
Related statements
FUNCTION and SUBROUTINE