XL Fortran for AIX 8.1

Language Reference



A LOGICAL type declaration statement specifies the length and attributes of objects and functions of type logical. Initial values can be assigned to objects.


            '-kind_selector-'  | '-::-'                |


DIMENSION (array_spec)
INTENT (intent_spec)


   |    '-KIND-- = -'                             |
   |                           (1)                |
   '- * --int_literal_constant--------------------'


  1. IBM Extension.

+-------------------------------IBM Extension--------------------------------+

specifies the length of logical entities: 1, 2, 4 or 8. int_literal_constant cannot specify a kind type parameter.

+----------------------------End of IBM Extension----------------------------+

For detailed information on rules about a particular attribute, refer to the statement of the same name.

is either IN, OUT, or INOUT

is the double colon separator. It is required if attributes are specified, = initialization_expr FORTRAN 95 Begins or NULL() FORTRAN 95 Ends is used.

is a list of dimension bounds


      | |     (1)       (2)  |  '-(--array_spec--)-' |
      | '- * -------len------'                       |
      |                       (3)       (4)          |
      '-(--array_spec--)-- * -------len--------------'
   |                            (5)    |
     +- = --initialization_expr------+
     |              (6)              |
     '- => --NULL()------------------'


  1. IBM Extension.

  2. IBM Extension.

  3. IBM Extension.

  4. IBM Extension.

  5. IBM Extension.

  6. Fortran 95.


is an object name or function name. array_spec cannot be specified for a function name.

+-------------------------------IBM Extension--------------------------------+

overrides the length as specified in kind_selector, and cannot specify a kind type parameter. The entity length must be an integer literal constant that represents one of the permissible length specifications.

+----------------------------End of IBM Extension----------------------------+

+-------------------------------IBM Extension--------------------------------+

provides an initial value for the entity specified by the immediately preceding name

+----------------------------End of IBM Extension----------------------------+

provides an initial value, by means of an initialization expression, for the entity specified by the immediately preceding name

+---------------------------------Fortran 95---------------------------------+

=> NULL()
provides the initial value for the pointer object

+-----------------------------End of Fortran 95------------------------------+


+---------------------------------Fortran 95---------------------------------+

Within the context of a derived type definition:

If => appears for a variable, the object must have the POINTER attribute.

+-----------------------------End of Fortran 95------------------------------+

If initialization_expr appears for a variable, the object cannot have the POINTER attribute.

Entities in type declaration statements are constrained by the rules of any attributes specified for the entities, as detailed in the corresponding attribute statements.

The type declaration statement overrides the implicit type rules in effect. You can use a type declaration statement that confirms the type of an intrinsic function. The appearance of a generic or specific intrinsic function name in a type declaration statement does not cause the name to lose its intrinsic property.

An object cannot be initialized in a type declaration statement if it is a dummy argument, an allocatable object, a pointer, a function result, an object in blank common, an integer pointer, an external name, an intrinsic name, or an automatic object. Nor can an object be initialized if it has the AUTOMATIC attribute. The object may be initialized if it appears in a named common block in a block data program unit or if it appears in a named common block in a module.

+---------------------------------Fortran 95---------------------------------+

In Fortran 95, a pointer can be initialized. Pointers can only be initialized by the use of => NULL().

+-----------------------------End of Fortran 95------------------------------+

The specification expression of an array_spec can be a nonconstant expression if the specification expression appears in an interface body or in the specification part of a subprogram. Any object being declared that uses this nonconstant expression and is not a dummy argument or a pointee is called an automatic object.

An attribute cannot be repeated in a given type declaration statement, nor can an entity be explicitly given the same attribute more than once in a scoping unit.

initialization_expr must be specified if the statement contains the PARAMETER attribute. If the entity you are declaring is a variable, and initialization_expr FORTRAN 95 Begins or NULL() FORTRAN 95 Ends is specified, the variable is initially defined.

+---------------------------------Fortran 95---------------------------------+

If the entity you are declaring is a derived type component, and initialization_expr or NULL() is specified, the derived type has default initialization.

+-----------------------------End of Fortran 95------------------------------+

a becomes defined with the value determined by initialization_expr, in accordance with the rules for intrinsic assignment. If the entity is an array, its shape must be specified either in the type declaration statement or in a previous specification statement in the same scoping unit. A variable or variable subobject cannot be initialized more than once. If a is a variable, the presence of initialization_expr FORTRAN 95 Begins or NULL() FORTRAN 95 Ends implies that a is a saved object, except for an object in a named common block. The initialization of an object could affect the fundamental storage class of an object.

An array_spec specified in the entity_decl takes precedence over the array_spec in the DIMENSION attribute.

An array function result that does not have the POINTER attribute must have an explicit-shape array specification.

If the entity declared is a function, it must not have an accessible explicit interface unless it is an intrinsic function.

+-------------------------------IBM Extension--------------------------------+

If T or F, defined previously as the name of a constant, appears in a type declaration statement, it is no longer an abbreviated logical constant but the name of the named constant.

+----------------------------End of IBM Extension----------------------------+



Related Information

[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]