HP 3000 Manuals

Statement Function Statement (Nonexecutable) [ HP FORTRAN 77/iX Reference ] MPE/iX 5.0 Documentation


HP FORTRAN 77/iX Reference

Statement Function Statement (Nonexecutable) 

The statement function statement defines a one-statement function.

[]
----------------------------------------------------------------------------------------------- | | | | | Item | Description/Default | Restrictions | | | | | ----------------------------------------------------------------------------------------------- | | | | | name | Name of the function. | None. | | | | | ----------------------------------------------------------------------------------------------- | | | | | parm | Formal argument. | Must be a simple variable. | | | | | ----------------------------------------------------------------------------------------------- | | | | | exp | Arithmetic, logical, or character | None. | | | expression. | | | | | | ----------------------------------------------------------------------------------------------- A statement function is a program-defined, single-statement computation that applies only to the program unit in which it is defined. A statement function statement can appear only after the specification statements and before the first executable statement of the program unit. The expression defines the actual computational procedure, which results in one value. When the statement function is referenced, the expression is evaluated using the actual arguments, and the value is assigned to the function name. The expression must be an arithmetic, logical, or character expression. The type of a statement function is determined by using the statement function name in a type statement or by implicit typing. The type of expression in a statement function statement must be compatible with the defined type of the name of the function. For example, arithmetic expressions must be used in arithmetic statement functions, logical expressions in logical statement functions, and character expressions in character statement functions. The arithmetic expression in an arithmetic statement function need not be the same type as the function name. For example, the expression can be type integer and the function name can be defined as type real. The expression value is converted to the statement function type at the time it is assigned to the function name. Statement functions can reference other previously defined statement functions. Statement functions cannot contain calls to themselves, nor can they contain indirect recursive calls. The values of any formal arguments in the expression are supplied by the actual arguments when the statement function is referenced. All other variables and constants in the expression derive their values from their definitions in the program unit. Examples Notes -------------------------------------------------------------------------------------- disp(a,b,c)=a + b*c disp is a statement function with three dummy arguments, a, b, and c. tim(t1)=t1/2 + b tim is a statement function with one dummy argument, t1. b is an actual variable that is declared elsewhere in the program unit.


MPE/iX 5.0 Documentation