Developer Guide and Reference

ID 767251
Date 10/31/2024
Public
Document Table of Contents

Statements Affecting Variables

The following table lists statements that are used to declare variables of intrinsic and derived types, to declare new types, and that can affect the value of variables. Statements that declare variables can specify attributes of the variables. Attributes are listed in the table following this one.

Name

Description

ASSOCIATE1

Associates a name (alias) with a data designator or expression that can be used to identify that designator or expression in a block of code.

BYTE

Specifies variables as the BYTE data type; BYTE is equivalent to INTEGER(1).

CHARACTER

Specifies variables as the CHARACTER data type.

COMMON

Defines one or more contiguous areas, or blocks, of physical storage (called common blocks) that can be accessed by any of the scoping units in an executable program.

COMPLEX

Specifies variables as the COMPLEX data type.

DATA

Assigns initial values to variables.

DOUBLE COMPLEX

Specifies variables as the DOUBLE COMPLEX data type, equivalent to COMPLEX(8).

DOUBLE PRECISION

Specifies variables as the DOUBLE-PRECISION real data type, equivalent to REAL(8).

ENUM

Begins the definition of an interoperable enumeration and may give the type a name.

ENUMERATOR

Associates integer values with named constant enumerators.

EQUIVALENCE

Specifies that two or more variables or arrays share the same memory location.

FINAL

Indicates a derived type is finalizable and specifies what its final subroutines are.

IMPLICIT

Specifies the default types for variables and functions.

IMPLICIT NONE

Disables implicit typing in the scope, or requires all external procedures to have explicit interfaces if invoked from the scope.

INTEGER

Specifies variables as the INTEGER data type.

LOGICAL

Specifies variables as the LOGICAL data type.

MAP

Within a UNION statement, delimits a group of variable type declarations that are to be ordered contiguously within memory.

NAMELIST

Declares a group name for a set of variables to be read or written in a single statement.

NULLIFY1

Disassociates a variable with the POINTER attribute (sets it to NULL).

REAL

Specifies variables as the REAL data type.

RECORD

Declares one or more variables of a user-defined structure type.

SEQUENCE

Prevents the compiler from optimizing the storage order of components in a derived type.

STRUCTURE

Defines a new variable type, composed of a collection of other variable types.

TYPE

Defines a new variable type, composed of a collection of other variable types.

UNION

Within a structure, causes two or more maps to occupy the same memory locations.

1 This is an executable statement.

The following table lists statements that give attributes to variables. Attributes also can be given to variables in their type declaration statement.

Name

Description

ALLOCATABLE

Indicates an entity can be dynamically allocated and deallocated.

ASYNCHRONOUS

Indicates a variable may be used in asynchronous input or output, or asynchronous communication.

AUTOMATIC

Declares a variable on the stack, rather than at a static memory location.

BIND

Indicates a variable or common block can interoperate with a C variable whose name has external linkage.

CODIMENSION

Specifies that an entity is a coarray and indicates its corank and cobounds, if any.

CONTIGUOUS

Indicates an array object is contiguous.

DIMENSION

Specifies that an entity is an array and indicates its rank and bounds.

EXTERNAL

Indicates an entity is an external procedure, a dummy procedure, a procedure pointer, or a block data subprogram.

INTENT

Indicates how a dummy argument is to be used: as an input argument (IN), an output argument (OUT), or as both input and output (INOUT).

INTRINSIC

Indicates an entity is an intrinsic procedure.

OPTIONAL

Indicates a dummy argument need not be associated with an actual argument in a procedure invocation.

PARAMETER

Equates a constant expression with a name.

POINTER

Indicates an entity can be associated with different data objects or procedures during the execution of a program. A pointer is either a data pointer or a procedure pointer, but not both.

PRIVATE

Limits the accessibility of a module entity by a particular name, or that of a component of a derived type declared in a module.

PROTECTED

Specifies limitations on the use of module entities.

PUBLIC

Makes a module entity accessible by USE association, or it makes a component of a derived type declared in a module accessible when the derived type is USE associated.

SAVE

Causes variables to retain their values between invocations of the procedure in which they are defined.

STATIC

Declares a variable is in a static memory location, rather than on the stack.

TARGET

Indicates a data object may become associated with a data pointer.

VALUE

Indicates a dummy argument is passed by value rather than by reference.

VOLATILE

Specifies that the value of an object is totally unpredictable based on information available to the current program unit.