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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Program Units and Procedures 8<br />

• If all the USE statements have ONLY options, all the only-lists are interpreted as a single,<br />

concatenated only-list. Only those entities named in one or more of the only-lists are<br />

accessible.<br />

If two or more generic interfaces that are accessible in a scoping unit have the same name, the<br />

same operator, or are both assignments, they are interpreted as a single generic interface.<br />

Otherwise, multiple accessible entities can have the same name only if no reference to the name is<br />

made in the scoping unit.<br />

The local names of entities made accessible by a USE statement must not be respecified with any<br />

attribute other than PUBLIC or PRIVATE. The local names can appear in namelist group lists, but<br />

not in a COMMON or EQUIVALENCE statement.<br />

Examples<br />

The following shows examples of the USE statement:<br />

MODULE MOD_A<br />

INTEGER :: B, C<br />

REAL E(25,5), D(100)<br />

END MODULE MOD_A<br />

...<br />

SUBROUTINE SUB_Y<br />

USE MOD_A, DX => D, EX => E ! Array D has been renamed DX and array E<br />

... ! has been renamed EX. Scalar variables B<br />

END SUBROUTINE SUB_Y<br />

! and C are also available to this subrou-<br />

... ! tine (using their module names).<br />

SUBROUTINE SUB_Z<br />

USE MOD_A, ONLY: B, C<br />

! Only scalar variables B and C are<br />

... ! available to this subroutine<br />

END SUBROUTINE SUB_Z<br />

...<br />

The following example shows a module containing common blocks:<br />

MODULE COLORS<br />

COMMON /BLOCKA/ C, D(15)<br />

COMMON /BLOCKB/ E, F<br />

...<br />

END MODULE COLORS<br />

...<br />

FUNCTION HUE(A, B)<br />

USE COLORS<br />

8-9

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

Saved successfully!

Ooh no, something went wrong!