Next: Extensions to namelist, Previous: Old-style kind specifications, Up: Extensions
gfortran allows old-style initialization of variables of the form:
INTEGER*4 i/1/,j/2/
REAL*8 x(2,2) /3*0.,1./
These are only allowed in declarations without double colons
(::), as these were introduced in Fortran 90 which also
introduced a new syntax for variable initializations. The syntax for
the individual initializers is as for the DATA statement, but
unlike in a DATA statement, an initializer only applies to the
variable immediately preceding. In other words, something like
INTEGER I,J/2,3/ is not valid.
Examples of standard conforming code equivalent to the above example, are:
! Fortran 90
INTEGER(4) :: i = 1, j = 2
REAL(8) :: x(2,2) = RESHAPE((/0.,0.,0.,1./),SHAPE(x))
! Fortran 77
INTEGER i, j
DOUBLE PRECISION x(2,2)
DATA i,j,x /1,2,3*0.,1./