+-------------------------------IBM Extension--------------------------------+
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--------------------------->< '-::-' |
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.
Attributes Compatible with the AUTOMATIC Attribute | ||||
---|---|---|---|---|
|
CALL SUB CONTAINS SUBROUTINE SUB INTEGER, AUTOMATIC :: VAR VAR = 12 END SUBROUTINE ! VAR becomes undefined END
Related Information
+----------------------------End of IBM Extension----------------------------+