IMPLICIT
Purpose
The IMPLICIT statement changes or confirms the default implicit typing or the default storage class for local entities or, with the form IMPLICIT NONE specified, voids the implicit type rules altogether.
Syntax
- declaration_type_spec
- specifies a data type. See Type Declaration.
- range
- is either a single letter or range of letters. A range of letters has the form
letter1-letter2, where
letter1 is the first letter in the range and
letter2, which follows
letter1 alphabetically, is the last letter in the range. Dollar
sign ($) and underscore (_) are also permitted in a range. The underscore (
_) follows the dollar sign ($), which follows theZ. Thus, the rangeY-_is the same asY,Z,$,_.
Rules
Letter ranges cannot overlap; that is, no more than one type can be specified for a given letter.
In a given scoping unit, if a character has not been specified in an
IMPLICIT statement, the implicit type for entities in a program unit or
interface body is default integer for entities that begin with the characters I-N,
and default real otherwise. The default for an internal or module procedure is the same as the
implicit type used by the host scoping unit.
For any data entity name that begins with the character specified by range_list, and for which you do not explicitly specify a type, the type specified by the immediately preceding declaration_type_spec is provided. Note that implicit typing can be to a derived type that is inaccessible in the local scope if the derived type is accessible to the host scope.
The implicit typing rules of the host scoping unit also apply within a
BLOCK construct.
A type specified in an IMPLICIT statement must not be a VECTOR type.
Deferred length type parameters cannot be specified in declaration_type_spec.
A character or a range of characters that you specify as STATIC or
AUTOMATIC can also appear in an IMPLICIT
statement for any data type. A letter in a range_list cannot have both
declaration_type_spec and UNDEFINED specified
for it in the scoping unit. Neither can both STATIC and
AUTOMATIC be specified for the same letter. 
If you specify the form IMPLICIT NONE in a scoping unit, you must use type declaration statements to specify data types for names local to that scoping unit. You cannot refer to a name that does not have an explicitly defined data type; this lets you control all names that are inadvertently referenced. When IMPLICIT NONE is specified, you cannot specify any other IMPLICIT statement in the same scoping unit, except ones that contain STATIC or AUTOMATIC. You can compile your program with the -qundef compiler option to achieve the same effect as an IMPLICIT NONE statement appearing in each scoping unit where an IMPLICIT statement is allowed.
IMPLICIT UNDEFINED turns off the implicit data typing defaults for
the character or range of characters specified. When you specify IMPLICIT
UNDEFINED, you must declare the data types of all symbolic names in the scoping unit
that start with a specified character. The compiler issues a diagnostic message for each symbolic
name local to the scoping unit that does not have an explicitly defined data type.
An IMPLICIT statement does not change the data type of an intrinsic function.
Using the -qsave/-qnosave compiler option modifies the
predefined conventions for storage class:
| -qsave compiler option | makes the predefined convention | IMPLICIT STATIC( a - _ ) |
| -qnosave compiler option | makes the predefined convention | IMPLICIT AUTOMATIC( a - _ ) |
Even if you specified the -qmixed compiler option, the range list items are
not case sensitive. For example, with -qmixed specified, IMPLICIT
INTEGER(A) affects the implicit typing of data objects that begin with A
as well as those that begin with a.
Examples
IMPLICIT INTEGER (B), COMPLEX (D, K-M), REAL (R-Z,A)
! This IMPLICIT statement establishes the following
! implicit typing:
!
! A: real
! B: integer
! C: real
! D: complex
! E to H: real
! I, J: integer
! K, L, M: complex
! N: integer
! O to Z: real
! $: real
! _: real
Related information
- Determining Type for a discussion of the implicit rules
- Storage classes for variables (IBM extension)
- -qundef option in the XL Fortran Compiler Reference
- -qsave option in the XL Fortran Compiler Reference
