5.9 IMPLICIT Statement

The IMPLICIT statement overrides the default implicit typing rules for names. (The default data type is INTEGER for names beginning with the letters I through N, and REAL for names beginning with any other letter.)

The IMPLICIT statement takes one of the following forms:

IMPLICIT type (a[, a]...)[, type (a[, a]...)]...
IMPLICIT NONE

type
Is a data type specifier (CHARACTER*(*) is not allowed).

a
Is a single letter, a dollar sign ($), or a range of letters in alphabetical order. The form for a range of letters is a1-a2 , where the second letter follows the first alphabetically (for example, A-C).

The dollar sign can be used at the end of a range of letters, since IMPLICIT interprets the dollar sign to alphabetically follow the letter Z. For example, a range of X-$ would apply to identifiers beginning with the letters X, Y, Z, or $.

Rules and Behavior

The IMPLICIT statement assigns the specified data type (and kind parameter) to all names that have no explicit data type and begin with the specified letter or range of letters. It has no effect on the default types of intrinsic procedures.

When the data type is CHARACTER*len, len is the length for character type. The len is an unsigned integer constant or an integer initialization expression enclosed in parentheses. The range for len is 1 to 2**31-1 for Tru64 UNIX and Linux systems, and on ia64 processors; 1 to 65535 for OpenVMS systems and on ia32 processors.

Names beginning with a dollar sign ($) are implicitly INTEGER.

The IMPLICIT NONE statement disables all implicit typing defaults. When IMPLICIT NONE is used, all names in a program unit must be explicitly declared. An IMPLICIT NONE statement must precede any PARAMETER statements, and there must be no other IMPLICIT statements in the scoping unit.


Note: To receive diagnostic messages when variables are used but not declared, you can specify a compiler option instead of using IMPLICIT NONE.

The following IMPLICIT statement represents the default typing for names when they are not explicitly typed:

IMPLICIT INTEGER (I-N), REAL (A-H, O-Z)

Examples

The following are examples of the IMPLICIT statement:

IMPLICIT DOUBLE PRECISION (D)
IMPLICIT COMPLEX (S,Y), LOGICAL(1) (L,A-C)
IMPLICIT CHARACTER*32 (T-V)
IMPLICIT CHARACTER*2 (W)
IMPLICIT TYPE(COLORS) (E-F), INTEGER (G-H)

For More Information:

For details on compiler options, see your user manual or programmer's guide.


Previous Page Next Page Table of Contents