02.07.2014 Views

Intel(R) Fortran Language Reference (online version)

Intel(R) Fortran Language Reference (online version)

Intel(R) Fortran Language Reference (online version)

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Program Units and Procedures 8<br />

INTEGER V1, V2<br />

CALL GROUP_SUBS (V1, V2)<br />

See Also<br />

“Defining Explicit Interfaces” for details on interface blocks<br />

Defining Generic Operators<br />

An interface block can be used to define a generic operator. The only procedures allowed in the<br />

interface block are functions that can be referenced as defined operations.<br />

The initial line for such an interface block takes the following form:<br />

INTERFACE OPERATOR (op)<br />

op<br />

Is one of the following:<br />

• A defined unary operator (one argument)<br />

• A defined binary operator (two arguments)<br />

• An extended intrinsic operator (number of arguments must be consistent with the intrinsic<br />

uses of that operator)<br />

The functions within the interface block must have one or two nonoptional arguments with intent<br />

IN, and the function result must not be of type character with assumed length. A defined operation<br />

is treated as a reference to the function.<br />

The following shows the form (and an example) of a defined unary and defined binary operation:<br />

Operation Form Example<br />

Defined unary .defined-operator. operand 1<br />

.MINUS. C<br />

Defined binary operand 2 .defined-operator. operand 3 B .MINUS. C<br />

1. The operand corresponds to the function’s dummy argument.<br />

2. The left operand corresponds to the first dummy argument of the function.<br />

3. The right operand corresponds to the second argument.<br />

For intrinsic operator symbols, the generic properties include the intrinsic operations they<br />

represent. Both forms of each relational operator have the same interpretation, so extending one<br />

form (such as >=) defines both forms ( >= and .GE.).<br />

The following is an example of a procedure interface block defining a new operator:<br />

INTERFACE OPERATOR(.BAR.)<br />

FUNCTION BAR(A_1)<br />

INTEGER, INTENT(IN) :: A_1<br />

8-51

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!