VMS Help  —  FORTRAN  Statements  INTERFACE  Generic Operators
  An interface block can be used to define a generic operator.  The
  only procedures allowed in the interface block are functions that
  can be referenced as defined operations.  Statement format for
  initial line in block:

     INTERFACE OPERATOR (op)

     op  Is one of the following:

         A defined unary  operator (one argument)

         A defined binary  operator (two arguments)

         An extended intrinsic operator (number of arguments
               must be consistent with the intrinsic uses of
               that operator)

  The functions within the interface block must have one or two
  nonoptional arguments with intent IN, and the function result must
  not be of type character with assumed length.  A defined operation
  is treated as a reference to the function.

  EXAMPLES:

    INTERFACE OPERATOR(.BAR.)
      FUNCTION BAR(A_1)
        INTEGER, INTENT(IN) :: A_1
        INTEGER :: BAR
      END FUNCTION BAR
    END INTERFACE

  The following example shows a way to reference function BAR by
  using the new operator:

    INTEGER B
    I = 4 + (.BAR. B)

  The following is an example of a procedure interface block with a
  defined operator extending an existing operator:

    INTERFACE OPERATOR(+)
      FUNCTION LGFUNC (A, B)
      LOGICAL, INTENT(IN) :: A(:), B(SIZE(A))
      LOGICAL :: LGFUNC(SIZE(A))
      END FUNCTION LGFUNC
    END INTERFACE

  The following example shows two equivalent ways to reference
  function LGFUNC:

    LOGICAL, DIMENSION(1:10) :: C, D, E
    N = 10
    E = LGFUNC(C(1:N), D(1:N))
    E = C(1:N) + D(1:N)
Close Help