Intel fortran-80 manual Referencing Statement Functions, Statement Function Limitations, 156.8

Models: fortran-80

1 130
Download 130 pages 742 b
Page 51
Image 51
5.1.3.1 Referencing Statement Functions

FORTRAN-80

Functions And Subroutines

The statement function name and the expression 'exp' may be of different types. The type of the value returned is as shown in Figure 3-2.

The dummy argument list indicates the order, number and type of arguments for the statement function. The names of dummy arguments have a scope of the statement function only, and each name may appear only once in the dummy argument list. The type of a dummy argument name is the same as it would be if the name were used outside the statement function.

The name of a dummy argument can be used to identify other dummy arguments of the same type in other statement-function statements. The name can also be used to identify a variable of the same type or a common block within the same program unit, but they have no other relationship.

5.1.3.1 Referencing Statement Functions

A statement function is referenced by specifying its symbolic name (with any re- quired actual arguments).

DATA A, B, C 110.0, 10.0, 3.81

FSUM(X) = A *(X* *2) + B*X + C

TOTAL = 33 + FSUM(3.0)

This operation substitutes the value '3.0'for every occurrence of 'X'in the function definition. At the end of the operation, the value of 'TOTAL'is

'156.8.'

5.1.3.2 Statement Function Limitations

All statement functions must follow all specification statements and must precede all executable statements.

The symbolic name of a statement function is local and cannot be a symbolic name in any specification statement, except in a type statement or as the name of a com- mon block in the same program unit. The name is also prohibited from being used in an EXTERNAL statement or as an actual argument.

A statement function cannot be of type character. If it has a dummy argument of type character, the length specification of that argument must be an integer cons- tant.

Each operand in the statement function expression 'exp' must be one of the follow- ing:

A constant:

FPROD(C) = C*3.1412

A variable reference:

FPROD(C) = C*3.1412+ AV12

An array element reference:

FSUM(C) = C + 2ITABLE(1,3)

An intrinsic function reference:

FHVP(A,B) = SQRT(A * *2 + B* *2)

A reference to a statement function:

FTOTAL(C) = C/3 + FUNC(3.8)

An external function reference:

FSU.B(C) = 3*C - EXFUN(3. 0, 3. 0,2. 5)

A dummy procedure reference:

FSUB(C) = 3*C - EXFUN(X, Y,Z)

5-3

Page 51
Image 51
Intel fortran-80 manual Referencing Statement Functions, Statement Function Limitations, 156.8