XL Fortran for AIX 8.1

Language Reference

INTENT

Purpose

The INTENT attribute specifies the intended use of dummy arguments.

Format



>>-INTENT--(--+-IN----+--)--+----+--dummy_arg_name_list--------><
              +-OUT---+     '-::-'
              '-INOUT-'
 
 

dummy_arg_name
is the name of a dummy argument, which cannot be a dummy procedure

Rules

If you specify a nonpointer, nonallocatable dummy argument, the INTENT attribute will have the following characteristics:

If you specify a pointer dummy argument, the INTENT attribute will have the following characteristics:

If you specify an allocatable dummy argument, the INTENT attribute will have the following characteristics:

If you do not specify the INTENT attribute for a pointer or allocatable dummy argument, its use is subject to the limitations and restrictions of the associated actual argument.

An actual argument that becomes associated with a dummy argument with an intent of OUT or INOUT must be definable. Hence, a dummy argument with an intent of IN, or an actual argument that is a constant, a subobject of a constant, or an expression, cannot be passed as an actual argument to a subprogram expecting an argument with an intent of OUT or INOUT.

An actual argument that is an array section with a vector subscript cannot be associated with a dummy array that is defined or redefined (that is, with an intent of OUT or INOUT).

+-------------------------------IBM Extension--------------------------------+

The %VAL built-in function, used for interlanguage calls, can only be used for an actual argument that corresponds to a dummy argument with an intent of IN, or that has no intent specified. This constraint does not apply to the %REF built-in function.

+----------------------------End of IBM Extension----------------------------+

Attributes Compatible with the INTENT Attribute


  • ALLOCATABLE
  • DIMENSION
  • OPTIONAL

  • POINTER
  • TARGET
  • VOLATILE

Examples

      PROGRAM MAIN
        DATA R,S /12.34,56.78/
        CALL SUB(R+S,R,S)
      END PROGRAM
 
      SUBROUTINE SUB (A,B,C)
        INTENT(IN) A
        INTENT(OUT) B
        INTENT(INOUT) C
        C=C+A+ABS(A)            ! Valid references to A and C
                                ! Valid redefinition of C
        B=C**2                  ! Valid redefinition of B
      END SUBROUTINE

Related Information


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]