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

Arguments<br />

140<br />

Arrays<br />

Derived types<br />

Pointers<br />

Procedure names<br />

Scalar dummy argument<br />

If the dummy argument is a scalar, the corresponding actual argument must be a scalar or a<br />

scalar expression, of the same kind and type. If the dummy argument is a character variable<br />

and has assumed length, it inherits the length of the actual argument. Otherwise, the length<br />

of the actual argument must be at least that of the dummy argument, and only the characters<br />

within the range of the dummy argument can be accessed by the subprogram. Lengths may<br />

differ for default character types only.<br />

Array dummy argument<br />

If the dummy argument is an assumed-shape array, the corresponding actual argument must<br />

match in kind, type, and rank; the dummy argument takes its shape from the actual<br />

argument, resulting in an element-by-element association between the actual and dummy<br />

arguments.<br />

If the dummy argument is an explicit-shape or assumed-size array, the kind and type of the<br />

actual argument must match but the rank need not. The elements are sequence<br />

associated—that is, the actual and dummy arguments are each considered to be a linear<br />

sequence of elements in storage without regard to rank or shape, and corresponding elements<br />

in each sequence are associated with each other in array element order.<br />

A consequence of sequence association is that the overall size of the actual argument must be<br />

at least that of the dummy argument, and only elements within the overall size of the dummy<br />

argument can be accessed by referenced procedure.<br />

For example, if an actual argument has this declaration:<br />

REAL a(0:3,0:2)<br />

and the corresponding dummy argument has this declaration:<br />

REAL d(2,3,2)<br />

then the correspondence between elements of the actual and dummy arguments is as follows:<br />

Dummy Actual<br />

------------------d(1,1,1)<br />

a(0,0)<br />

d(2,1,1) a(1,0)<br />

d(1,2,1) a(2,0)<br />

Chapter 7

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

Saved successfully!

Ooh no, something went wrong!