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.

<strong>HP</strong> <strong>Fortran</strong> statements<br />

OPTIONAL (statement and attribute)<br />

OPTIONAL (statement and attribute)<br />

Identifies optional arguments for procedures.<br />

Syntax<br />

The syntax of the type declaration statement with the OPTIONAL attribute is:<br />

type , attrib-list :: dummy-argument-name-list<br />

type<br />

attrib-list<br />

Table 10-41<br />

dummy-argument-name-list<br />

382<br />

is a valid type specification (INTEGER, REAL, LOGICAL, CHARACTER, TYPE (<br />

name), etc.).<br />

is a comma-separated list of attributes including OPTIONAL and optionally<br />

those attributes compatible with it, namely:<br />

DIMENSION INTENT TARGET<br />

EXTERNAL POINTER VOLATILE<br />

is a comma-separated list of dummy-argument-names.<br />

The syntax of the OPTIONAL statement is:<br />

OPTIONAL [::] dummy-argument-name-list<br />

Description<br />

If a dummy argument has the OPTIONAL attribute, the corresponding actual argument need<br />

not appear in a procedure reference. In cases where there are arguments that generally do not<br />

change from one reference to another, it is convenient to specify that the arguments are<br />

optional and provide default values for them. They can then be omitted from references in<br />

these general cases. The presence of an optional argument in a procedure may be determined<br />

by using the PRESENT intrinsic function.<br />

Many uses of the ENTRY statement in FORTRAN 77 programs can be replaced by the use of<br />

optional arguments.<br />

ThefollowingrestrictionsapplytotheuseoftheOPTIONAL attribute:<br />

Chapter 10

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

Saved successfully!

Ooh no, something went wrong!