Re: Type specification and initialization expressions



Tobias Burnus wrote:
Hello,

Is the following code valid or not?

implicit none
REAL(kind(0.0d0)), dimension(kind(xyz)) :: xyz
REAL, PARAMETER :: xxx(kind(xxx)) = 1.0

This is accepted by NAG f95 and gfortran (and both have then size(xyz)
== kind(0d0)), but it is unclear for me whether this is valid.

I don't think it is since KIND(xyz) is not defined until after xyz is
declared. I don't think *during* the declaration counts as *after*.
The following has been discussed before and I think was determined
to be non-standard for the same reason:

Real :: X(5), Y(size(x))

Even if such things were standard, I would avoid then for legibility
reassons.

--
J. Giles

"I conclude that there are two ways of constructing a software
design: One way is to make it so simple that there are obviously
no deficiencies and the other way is to make it so complicated
that there are no obvious deficiencies." -- C. A. R. Hoare


.