Next: Old-style variable initialization, Up: Extensions implemented in GNU Fortran [Contents][Index]
6.1.1 Old-style kind specifications
GNU Fortran allows old-style kind specifications in declarations. These look like:
TYPESPEC*size x,y,z
where TYPESPEC
is a basic type (INTEGER
, REAL
,
etc.), and where size
is a byte count corresponding to the
storage size of a valid kind for that type. (For COMPLEX
variables, size
is the total size of the real and imaginary
parts.) The statement then declares x
, y
and z
to
be of type TYPESPEC
with the appropriate kind. This is
equivalent to the standard-conforming declaration
TYPESPEC(k) x,y,z
where k
is the kind parameter suitable for the intended precision. As
kind parameters are implementation-dependent, use the KIND
,
SELECTED_INT_KIND
and SELECTED_REAL_KIND
intrinsics to retrieve
the correct value, for instance REAL*8 x
can be replaced by:
INTEGER, PARAMETER :: dbl = KIND(1.0d0) REAL(KIND=dbl) :: x