A named data object, such as a variable, named constant, or function result, is
given the properties of an intrinsic or user-defined data type, either
implicitly (based on the first letter of the name) or through a type
declaration statement. Additional information about a named data object, known
as the data object's attributes, can also be specified, either in a type
declaration statement or in separate statements specific to the attributes that
apply.
Once a data object has a name, it can be accessed in its entirety by referring
to that name. For some data objects, such as character strings, arrays, and
derived types, portions of the data object can also be accessed directly. In
addition, aliases for a data object or a portion of a data object, known as
pointers, can be established and referred to.
In the absence of a type declaration statement, a named data object's type is
determined by the first letter of its name. The letters I through N begin
INTEGER data objects and the other letters begin REAL data objects. These
implicit typing rules can be customized or disabled using the IMPLICIT
statement. IMPLICIT NONE can be used to disable all implicit typing for a
scoping unit.
A type declaration statement specifies the type, type parameters, and attributes
of a named data object or function. A type declaration statement is available
for each intrinsic type, INTEGER, REAL (and DOUBLE PRECISION), COMPLEX,
LOGICAL, or CHARACTER, as well as for derived types (see Derived Types).
Attributes
Besides type and type parameters, a data object or function can have one or more
of the following attributes, which can be specified in a type declaration
statement or in a separate statement particular to the attribute:
-
POINTER -- the data object is to be used as an alias for another data object of
the same type, kind, and rank (see
POINTER Statement).
-
TARGET -- the data object that is to be aliased by a POINTER data object (see
TARGET Statement).
-
ALLOCATABLE -- the data object is an array that is not of fixed size, but is to
have memory allocated for it as specified during execution of the program (see
ALLOCATABLE Statement).
-
INTENT(IN) -- the dummy argument will not change in the subprogram
-
INTENT(OUT) -- the dummy argument is undefined on entry to the subprogram
-
INTENT(IN OUT) -- the dummy argument has an initial value on entry and may be
redefined within the subprogram (see
INTENT Statement).
-
PUBLIC -- the named data object or procedure in a MODULE program unit is
accessible in a program unit that uses that module (see
PUBLIC Statement).
-
PRIVATE -- the named data object or procedure in a MODULE program unit is
accessible only in the current module (see
PRIVATE Statement).
-
OPTIONAL -- the dummy argument need not have a corresponding actual argument in
a reference to the procedure in which the dummy argument appears (see
OPTIONAL Statement).
-
SAVE -- the data object retains its value, association status, and allocation
status after a RETURN or END statement (see
SAVE Statement).
-
SEQUENCE -- the order of the component definitions in a derived-type definition
is the storage sequence for objects of that type (see
SEQUENCE Statement).
-
VOLATILE -- the data object may be referenced, become
redefined or undefined by means not specified in the Fortran standard (see
VOLATILE Statement).
-
DLL_EXPORT -- the name is an external
procedure, or a common block name, that to be a DLL (see
DLL_EXPORT Statement).
-
DLL_IMPORT -- the name is an external
procedure, or a common block name, that uses a DLL (see
DLL_IMPORT Statement).
-
ML_EXTERNAL -- the name is an external
procedure, or a common block name, that is available for calling from a mixed
language procedure (see
ML_EXTERNAL Statement).