next up previous contents index
Next: Guidelines Up: Statement Functions Previous: Statement Functions

Statement Function Rules

Statement function statements must appear after any the specification statements but before all executable statements in the program unit. They may be intermixed with DATA and FORMAT statements. The general form is:
function ( dummy1, dummy2, ... dummyN ) = expression
The function may have any data type; the expression will normally have the same data type but if both have an arithmetic type then the normal conversion rules for arithmetic assignment statements apply.

The name of the function must be distinct from all other symbolic names in the program unit. It may appear in type statements but not in other specification statements. (There is one exception: a common block is permitted to have the same name as a statement function but since common block names always appear between slashes there is little risk of confusion). If the function has character type its length must be an integer constant expression.

The dummy arguments are simply symbolic names. A name may not appear more than once in the same list. These names may be used elsewhere in the program unit as variables of the same data type.

The expression must contain the dummy arguments as operands. The operands may also include:

Note that character substrings are not permitted. The variables and array elements used in the expression must be defined at the time that the function reference is executed.



Mario Storti
Wed Nov 4 19:32:56 ART 1998