06.03.2014 Views

Intel Fortran Language Reference - NCI National Facility

Intel Fortran Language Reference - NCI National Facility

Intel Fortran Language Reference - NCI National Facility

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

8 <strong>Intel</strong> <strong>Fortran</strong> <strong>Language</strong> <strong>Reference</strong><br />

The actual argument and corresponding dummy procedure must both be subroutines or both be<br />

functions.<br />

If the interface of the dummy procedure is explicit, the type and kind parameters, and rank of the<br />

associated actual procedure must be the same as that of the dummy procedure.<br />

If the interface of the dummy procedure is implicit and the procedure is referenced as a subroutine,<br />

the actual argument must be a subroutine or a dummy procedure.<br />

If the interface of the dummy procedure is implicit and the procedure is referenced as a function or<br />

is explicitly typed, the actual argument must be a function or a dummy procedure.<br />

Dummy procedures can be declared optional, but they must not be declared with an intent.<br />

The following is an example of a procedure used as an argument:<br />

REAL FUNCTION LGFUNC(BAR)<br />

INTERFACE<br />

REAL FUNCTION BAR(Y)<br />

REAL, INTENT(IN) :: Y<br />

END<br />

END INTERFACE<br />

...<br />

LGFUNC = BAR(2.0)<br />

...<br />

END FUNCTION LGFUNC<br />

See Also<br />

“Argument Association”<br />

<strong>Reference</strong>s to Generic Procedures<br />

Generic procedures are procedures with different specific names that can be accessed under one<br />

generic (common) name. In FORTRAN 77, generic procedures were limited to intrinsic<br />

procedures. In <strong>Fortran</strong> 90, you can use generic interface blocks to specify generic properties for<br />

intrinsic and user-defined procedures.<br />

If you refer to a procedure by using its generic name, the selection of the specific routine is based<br />

on the number of arguments and the type and kind parameters, and rank of each argument.<br />

All procedures given the same generic name must be subroutines, or all must be functions. Any<br />

two must differ enough so that any invocation of the procedure is unambiguous.<br />

The following sections describe references to generic intrinsic functions and show an example of<br />

using intrinsic function names.<br />

8-38

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

Saved successfully!

Ooh no, something went wrong!