Type specification and initialization expressions



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.

For the following I am rather sure that it is valid:
REAL, DIMENSION(2,2), PARAMETER :: xyz2 = RESHAPE((/ 1,2,3,4 /),
SHAPE(xyz2))
REAL, PARAMETER :: yyy = kind(yyy)

while the following should be invalid:
REAL(8), PARAMETER :: zzz(size(zzz)) = 1 ! Obviously - which
dimension one should get?
real, parameter :: z = transfer(1234, z)

My starting point was "7.1.7 Initialization expression" (esp. last
paragraph).

Tobias
.



Relevant Pages