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.

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

2. If the procedure name is specified with the INTRINSIC attribute in one of the following, the<br />

reference is to that intrinsic procedure:<br />

a. The same scoping unit<br />

b. A module made accessible by a USE statement in the scoping unit<br />

The reference must be consistent with the interface of that intrinsic procedure.<br />

3. If the following is true, the reference is resolved by applying rules 1 and 2 to the host scoping<br />

unit:<br />

a. The procedure name is established to be generic in the host scoping unit<br />

b. There is agreement between the scoping unit and the host scoping unit as to whether the<br />

procedure is a function or subroutine name.<br />

4. If none of the preceding rules apply, the reference must be to the generic intrinsic procedure<br />

with that name. The reference must be consistent with the interface of that intrinsic procedure.<br />

Example<br />

The following example shows how a module can define three separate procedures, and a main<br />

program give them a generic name DUP through an interface block. Although the main program<br />

calls all three by the generic name, there is no ambiguity since the arguments are of different data<br />

types, and DUP is a function rather than a subroutine. The module UN_MOD must give each<br />

procedure a different name.<br />

MODULE UN_MOD<br />

!<br />

CONTAINS<br />

subroutine dup1(x,y)<br />

real x,y<br />

print *, ' Real arguments', x, y<br />

end subroutine dup1<br />

subroutine dup2(m,n)<br />

integer m,n<br />

print *, ' Integer arguments', m, n<br />

end subroutine dup2<br />

character function dup3 (z)<br />

character(len=2) z<br />

dup3 = 'String argument '// z<br />

end function dup3<br />

END MODULE<br />

15-6

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

Saved successfully!

Ooh no, something went wrong!