Bertrand Meltz writes:
> implicit none
> real a(n)
> integer, parameter :: n = 100
> Some compilers accept that, some don't (because n is declared
> after a).
> What is the rule, what does the standard say in this case?
>From f95 7.1.6.2.
A variable in a specification expression shall have its type and type
parameters, if any, specified by a previous declaration in the same
scoping unit, or by the implicit typing rules in effect for the
scoping unit, or by host or use association. If a variable in a
specification expression is typed by the implicit typing rules, its
appearance in any subsequent type declaration statement shall confirm
the implied type and type parameters.
Hmm. Now that I've cited this, I see that it just mentions variables.
You'd sure think that the same thing should apply to things other
than variables (i.e. named constants and functions). Lets see...
Perhaps the named constant case is covered somewhere else. (Seems
like the wording here ought to be more general, even if some cases
are also covered elsewhere, but...).
Ok. Here it is. f95 5.1.2.1
A named constant shall not be referenced in any other context unless
it has been defined in a prior PARAMETER statement or type declaration
statement using the PARAMETER attribute, or made accessible by use
association or host association.
--
Richard Maine
[log in to unmask]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|