02.07.2013 Views

HP Fortran Programmer's Reference

HP Fortran Programmer's Reference

HP Fortran Programmer's Reference

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.

Arguments<br />

Program units and procedures<br />

Arguments<br />

Arguments data to be passed during a procedure call. Arguments are of two sorts: dummy<br />

arguments and actual arguments. Dummy arguments are specified in the argument list in a<br />

procedure definition. They define the number, type, kind, and rank of the actual arguments.<br />

The actual arguments are the arguments that appear in the procedure reference and are the<br />

actual entities to be used by the referenced procedure, even though they are known by the<br />

dummy argument names.<br />

This section covers the following topics related to arguments:<br />

Argument association<br />

Keyword option<br />

Duplicated association<br />

INTENT attribute<br />

%REF and %VAL<br />

Argument association<br />

Argument association is the linkage of actual argument to dummy argument that initially<br />

occurs when a procedure having arguments is invoked. During the execution of the referenced<br />

procedure, the dummy arguments are effectively aliases for the actual arguments. After<br />

control returns to the program unit making the reference, the dummy arguments and actual<br />

arguments are no longer associated, and the actual arguments may no longer be referenced by<br />

the dummy argument names.<br />

The principle of argument association is positional: the first item in the list of actual<br />

arguments is associated with the first item in the list of dummy arguments, and so on with<br />

the remaining arguments in each list. However, the programmer can use the keyword option<br />

to override this positional correspondence; see “Keyword option” on page 143.<br />

Dummy and actual arguments must agree in kind, type, and rank. The corresponding dummy<br />

and actual arguments must both be scalars or both arrays; if they are both arrays, they must<br />

have the same dimensionality. Likewise, if an actual argument is an expression or a reference<br />

to a function, it must match the type and kind of the dummy argument.<br />

The following sections provide more detailed information about these types of dummy<br />

arguments:<br />

Scalars<br />

Chapter 7 139

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

Saved successfully!

Ooh no, something went wrong!