15.1.10 INTEGER Directive

The INTEGER directive specifies the default integer kind. This directive takes the following form: [See Note]

cDEC$ INTEGER:{1|2|4|8}

Is one of the following: C (or c), !, or * (see Section 15.1.1).

Rules and Behavior

The INTEGER directive specifies a size of 1 (KIND=1), 2 (KIND=2), 4 (KIND=4), or 8 (KIND=8) bytes for default integer numbers.

When the INTEGER directive is effect, all default integer variables are of the kind specified in the directive. Only numbers specified or implied as INTEGER without KIND are affected.

The INTEGER directive can only appear at the top of a program unit. A program unit is a main program, an external subroutine or function, a module or a block data program unit. The directive cannot appear between program units, or at the beginning of internal subprograms. It does not affect modules invoked with the USE statement in the program unit that contains it.

The default logical kind is the same as the default integer kind. So, when you change the default integer kind you also change the default logical kind.


Consider the following:

 INTEGER i                 ! a 4-byte integer
 WRITE(*,*) KIND(i)
 WRITE(*,*) KIND(i)        ! still a 4-byte integer
                           !   not affected by setting in subroutine
    INTEGER j              ! a 2-byte integer
    WRITE (*,*) KIND(j)

Note: The following form is also allowed: !MS$INTEGER:{2|4|8}

For More Information:

Previous Page Next Page Table of Contents