Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 7/13/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

IMPLICIT

Statement: Overrides the default implicit typing rules for names. (The default data type is default INTEGER kind for names beginning with the letters I through N, and default REAL kind for names beginning with any other letter.) An IMPLICIT NONE statement overrides all implicit typing in a scoping unit, or it indicates that all dummy procedures and externals must explicitly be given the external attribute.

The IMPLICIT statement takes one of the following forms:

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

IMPLICIT NONE [(spec-list])

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).

spec

Is TYPE or EXTERNAL. The keyword must appear in parentheses. If more than one keyword is present, they must be separated by commas.

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 $.

In Intel® Fortran, the parentheses around the list of letters are optional.

Description

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 specification expression enclosed in parentheses. The range for len is 1 to 2**31-1 on IA-32 architecture; 1 to 2**63-1 on Intel® 64 architecture.

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. An IMPLICIT NONE (TYPE) statement is the same as an IMPLICIT NONE statement. If an IMPLICIT NONE (EXTERNAL) statement appears in a scoping unit, all dummy procedures and external procedures in that scope or a contained scope of BLOCK must have an accessible explicit interface or be declared EXTERNAL.

NOTE:

To receive diagnostic messages when variables are used but not declared, you can specify compiler option warn declarations instead of using IMPLICIT NONE or IMPLICIT NONE (TYPE). To receive diagnostic messages when external and dummy procedures have not explicitly been given the EXTERNAL attribute, you can specify compiler option warn externals instead of using IMPLICIT NONE (EXTERNAL).

The following IMPLICIT statement represents the default typing as specified by the Fortran Standard for names when they are not explicitly typed:

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

Example

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) 
IMPLICIT NONE (EXTERNALS, TYPE)    ! Must be the only IMPLICIT statement in a scoping unit

The following shows another example:

SUBROUTINE FF (J)
IMPLICIT INTEGER (a-b), CHARACTER*(J+1) (n), TYPE(fried) (c-d)
TYPE fried
INTEGER e, f
REAL g, h
END TYPE
age = 10 ! integer
name = 'Paul' ! character 
c%e = 1 ! type fried, integer component