Extended intrinsic and defined operations

A defined operation is either a defined unary operation or a defined binary operation. It is defined by a function and a generic interface (see Interface blocks and Type-bound procedures (Fortran 2003)). A defined operation is not an intrinsic operation, although an intrinsic operator can be extended in a defined operation. For example, to add two objects of derived type, you can extend the meaning of the intrinsic binary operator for addition (+). If an extended intrinsic operator has typeless operands, the operation is evaluated intrinsically.

The operand of a unary intrinsic operation that is extended must not have a type that is required by the intrinsic operator. Either or both of the operands of a binary intrinsic operator that is extended must not have the types or ranks that are required by the intrinsic operator.

The defined operator of a defined operation must be defined in a generic interface.

A defined operator is an extended intrinsic operator or has the form:
Read syntax diagramSkip visual syntax diagram
      .-------------.      
      V             |      
>>-.----+-letter--+-+--.---------------------------------------><
        |     (1) |        
        +- _ -----+        
        |     (2) |        
        '- $ -----'        

Notes:
  1. XL Fortran defined operator
  2. XL Fortran defined operator

In Fortran 90 and Fortran 95, a defined operator must not contain more than 31 letters, and must not be the same as any intrinsic operator or logical literal constant. In Fortran 2003 the letter limit for a defined operator is 63.

See Generic interface blocks for details on defining and extending operators in an interface block. See Type-bound procedures (Fortran 2003) for details on defining and extending operators that are bound to a derived type.



Voice your opinion on getting help information Ask IBM compiler experts a technical question in the IBM XL compilers forum Reach out to us