XL Fortran for AIX 8.1

Language Reference

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

AUTOMATIC

Purpose

The AUTOMATIC attribute specifies that a variable has a storage class of automatic; that is, the variable is not defined once the procedure ends.

Format



>>-AUTOMATIC--+----+--automatic_list---------------------------><
              '-::-'
 
 

automatic
is a variable name or an array declarator with an explicit-shape specification list or a deferred-shape specification list

Rules

If automatic has the same name as the name of the function in which it is declared, it must not be of type character or of derived type.

Function results that are pointers or arrays, dummy arguments, statement functions, automatic objects, or pointees must not have the AUTOMATIC attribute. A variable with the AUTOMATIC attribute cannot be defined in the scoping unit of a module. A variable that is explicitly declared with the AUTOMATIC attribute cannot be a common block item.

A variable must not have the AUTOMATIC attribute specified more than once in the same scoping unit.

Any variable declared as AUTOMATIC within the scope of a thread's work will be local to that thread.

If the -qinitauto compiler option is not specified, a variable with the AUTOMATIC attribute cannot be initialized, either with a DATA statement or with a type declaration statement. If the -qinitauto option is specified, all bytes of storage for variables with the AUTOMATIC attribute are initialized to a specified byte value or, if no value is specified, to zero.

If automatic is a pointer, the AUTOMATIC attribute applies to the pointer itself, not to any target that is (or may become) associated with the pointer.

Local variables have a default storage class of automatic. See "-qsave Option" in the User's Guide for details on the default settings with regard to the invocation commands.

Note:
An object with the AUTOMATIC attribute should not be confused with an automatic object. See Automatic Objects.
Attributes Compatible with the AUTOMATIC Attribute


  • ALLOCATABLE
  • DIMENSION

  • POINTER
  • TARGET

  • VOLATILE

Examples

CALL SUB
CONTAINS
  SUBROUTINE SUB
    INTEGER, AUTOMATIC :: VAR
    VAR = 12
  END SUBROUTINE                  ! VAR becomes undefined
END

Related Information

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


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