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.

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

AUTOMATIC (extension)<br />

AUTOMATIC (extension)<br />

Makes procedure variables and arrays automatic.<br />

Syntax<br />

AUTOMATIC var-name-list<br />

var-name-list is a comma-separated list of names of variables and arrays to be declared as<br />

automatic.Arraynamesmaybefollowedbyanoptional<br />

explicit-shape-spec.<br />

Description<br />

The AUTOMATIC statement is provided as an <strong>HP</strong> extension.<br />

If a variable or array declared within a procedure is declared as automatic, then there is one<br />

copy of it for each invocation of the procedure. Space is allocated on entry to the procedure and<br />

deallocated on exit. This is also the default for variables that do not have the SAVE or STATIC<br />

attribute, unless the +save option has been specified.<br />

If it is required to have the same copy of a variable available to each invocation of the routine<br />

(for example, to keep a record of the depth of recursion), then the variable should have the<br />

SAVE attribute.<br />

Note the following:<br />

246<br />

The AUTOMATIC statement may only be used within a procedure.<br />

Local variables are AUTOMATIC by default.<br />

Arguments and function values are AUTOMATIC.<br />

Automatic variables may not appear in EQUIVALENCE, DATA or SAVE statements.<br />

The AUTOMATIC attribute is not the same as automatic arrays and automatic character<br />

strings.<br />

Examples<br />

AUTOMATIC r, s, u, v, w(10)<br />

Related statements<br />

SAVE and STATIC<br />

Chapter 10

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

Saved successfully!

Ooh no, something went wrong!