FORTRAN 77 Language Reference

IMPLICIT

The IMPLICIT statement confirms or changes the default type of names.

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

IMPLICIT NONE

IMPLICIT UNDEFINED(A-Z) u

Parameter 

Description 

type

BYTE u

CHARACTER

CHARACTER*n (where n must be greater than 0)

CHARACTER*(*)

COMPLEX

COMPLEX*8 u

COMPLEX*16 u

COMPLEX*32 u (SPARC only)

DOUBLE COMPLEX u

DOUBLE PRECISION

INTEGER

INTEGER*2 u

INTEGER*4 u

INTEGER*8 u

LOGICAL

LOGICAL*1 u

LOGICAL*2 u

LOGICAL*4 u

LOGICAL*8 u

REAL

REAL*4 u

REAL*8 u

REAL*16 u (SPARC only)

AUTOMATIC u

STATIC u

a

Either a single letter or a range of single letters in alphabetical order. A range of letters can be specified by the first and last letters of the range, separated by a minus sign.  

Description

The different uses for implicit typing and no implicit typing are described here.

Implicit Typing

The IMPLICIT statement can also indicate that no implicit typing rules apply in a program unit.

An IMPLICIT statement specifies a type and size for all user-defined names that begin with any letter, either a single letter or in a range of letters, appearing in the specification.

An IMPLICIT statement does not change the type of the intrinsic functions.

An IMPLICIT statement applies only to the program unit that contains it.

A program unit can contain more than one IMPLICIT statement.

IMPLICIT types for particular user names are overridden by a type statement.


Note -

Compiling with any of the options -dbl, -i2, -r8, or -xtypemap can alter the assumed size of names typed with an IMPLICIT statement that does not specify a size: IMPLICIT REAL (A-Z). See Chapter 2 and the Fortran User's Guide for details.


No Implicit Typing

The second form of IMPLICIT specifies that no implicit typing should be done for user-defined names, and all user-defined names shall have their types declared explicitly.

If either IMPLICIT NONE or IMPLICIT UNDEFINED (A-Z) is specified, there cannot be any other IMPLICIT statement in the program unit.

Restrictions

IMPLICIT statements must precede all other specification statements.

The same letter can appear more than once as a single letter, or in a range of letters in all IMPLICIT statements of a program unit. @

The FORTRAN 77 Standard restricts this usage to only once. For f77, if a letter is used twice, each usage is declared in order. See Example 4.

Examples

Example 1: IMPLICIT: everything is integer:


       IMPLICIT INTEGER (A-Z) 
       X = 3 
       K = 1 
       STRING = 0 

Example 2: Complex if it starts with U, V, or W; character if it starts with C or S:


       IMPLICIT COMPLEX (U,V,W), CHARACTER*4 (C,S) 
       U1 = ( 1.0, 3.0) 
       STRING = 'abcd'
       I = 0 
       X = 0.0 

Example 3: All items must be declared:


       IMPLICIT NONE 
       CHARACTER STR*8 
       INTEGER N 
       REAL Y 
       N = 100 
       Y = 1.0E5 
       STR = 'Length'

In the above example, once IMPLICIT NONE is specified in the beginning. All the variables must be declared explicitly.

Example 4: A letter used twice: @


       IMPLICIT INTEGER (A-Z)
       IMPLICIT REAL (A-C)
       C = 1.5E8
       D = 9

In the above example, D through Z implies INTEGER, and A through C implies REAL.