02.07.2013 Views

HP Fortran Programmer's Reference

HP Fortran Programmer's Reference

HP Fortran Programmer's Reference

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<br />

Terminology and concepts<br />

Procedures<br />

A procedure is a subroutine or function that contains a sequence of statements and that<br />

may be invoked during program execution. Depending on where and how it is used, a<br />

procedure can be one of the following:<br />

124<br />

Intrinsic procedures are defined by the language and are available for use without any<br />

declaration or definition. Intrinsic procedures implement common computations that are<br />

important to scientific and engineering applications. Intrinsic procedures are described in<br />

detail in Chapter 11, “Intrinsic procedures,” on page 467.<br />

An external procedure is a separately compilable program unit whose name and any<br />

additional entry points have global scope. External procedures are described in “External<br />

procedures” on page 129.<br />

An internal procedure has more limited accessibility than an external procedure. It can<br />

appear only within a main program unit or an external procedure and cannot be accessed<br />

outside of its hosting program unit. Internal procedures are described in “Internal<br />

procedures” on page 135.<br />

A module procedure can be defined only within a module program unit and can be<br />

accessed only by use association. Module procedures are described in “Modules” on<br />

page 158.<br />

Scope<br />

All defined <strong>Fortran</strong> entities have a scope within which their properties are known. For<br />

example, a label used within a subprogram cannot be referenced directly from outside the<br />

subprogram; the subprogram is the scoping unit of the label. A variable declared within a<br />

subprogram has a scope that is the subprogram. A common block name can be used in any<br />

program unit, and it refers to the same entity—that is, the name has global scope. At the<br />

other extreme, the index variable used within an implied-DO loop in a DATA statement or array<br />

constructor has a scope consisting only of the implied-DO loop construct itself.<br />

Association<br />

If the concept of scope limits the accessibility of entities, then the concept of association<br />

permits different entities to become accessible to each other in the same or different scope.<br />

The different types of association are:<br />

Argument association is the association that is established between actual arguments<br />

and dummy arguments during a procedure reference. For more information, see<br />

“Argument association” on page 139.<br />

Chapter 7

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

Saved successfully!

Ooh no, something went wrong!