FORTRAN 77 Language Reference

Fortran 90-Style Constants @

The Sun Fortran 77 compiler (release 5.0) recognizes the Fortran 90-style syntax for integer and real constants that allows literal specification of the size of the data item. In Fortran 90 terminology, a constant literal may include an optional trailing underscore followed by a "kind type parameter". @

In the Sun Fortran 77 implementation, the "kind type parameter" is limited to the digits 1, 2, 4, or 8, and its use specifies the data size, in bytes, of the literal constant. For example:


12_8                specifies an 8-byte integer constant, value = 12
12_4                specifies a 4-byte integer constant, value = 12
1.345E-10_8         specifies an 8-byte real constant, value = 1.345E-10
(-1.5_8,.895E-3_8)  specifies a complex constant with 8-byte real and imaginary parts

With complex constants, the real and imaginary parts may be specified with different kind type parameters, (1.0_8,2.0_4), but the resulting data item will have the real and imaginary parts with the same size, taking the larger one specified.

This construction is valuable when calling subprograms with constant arguments when a specific data type is required, as in the following example:


        call suby(A,1.5_8,0_8,Y)
        ...
        subroutine suby(H0, M, N, W)
        INTEGER *8 M, N,
        ...