Next: Pure function definition
Up: Pure Procedures
Previous: Pure Procedures
If a user-defined procedure is used in a context that requires it to be
pure, then its interface must be explicit in the scope of that use, and
that interface must specify the PURE attribute.
This attribute is specified in the function-stmt or
subroutine-stmt by an extension of rules R1217 (for prefix) and
R1220 (for subroutine-stmt) in the
Fortran 90 standard. Rule R1216 (for function-stmt) is
not changed, but is rewritten here as Rule
XBNF
prefix -to -rule
to
prefix-spec -to -rule
to
function-stmt -to -rule
to
function-stuff -to -rule
to
subroutine-stmt -to -rule
to
subroutine-stuff -to -rule
to
(For a discussion of the extrinsic-prefix
(Rule
Intrinsic functions, including the HPF intrinsic functions, are always pure
and require no explicit declaration of this fact.
Intrinsic subroutines
are pure if they are elemental (i.e., MVBITS) but not otherwise.
Functions in the HPF library are declared to be pure.
A statement function is pure if and only if all functions that it
references are pure.
A procedure with the PURE attribute is referred to as a ``pure
procedure'' in the following constraints.
for clarity.
to is prefix-spec [ prefix-spec ] ...
to is type-spec
-to or RECURSIVE
-to or PURE
-to or extrinsic-prefix
to is [ prefix ] FUNCTION function-name function-stuff
to is ( [ dummy-arg-name-list ] ) [ RESULT ( result-name ) ]
to is [ prefix ] SUBROUTINE subroutine-name subroutine-stuff
to is [ ( [ dummy-arg-list ] ) ]
XBNF
), see Section
.)