A specification expression is a restricted expression that is of type integer and has a scalar value. This type of expression appears only in the declaration of array bounds and character lengths.

In a restricted expression, each operation is intrinsic and each operand is one of the following:

- A constant or subobject of a constant
- A variable that is one of the following:
- A dummy argument that does not have the OPTIONAL or INTENT (OUT) attribute (or the subobject of such a variable)
- In a common block (or the subobject of such a variable)
- Made accessible by use or host association (or the subobject of such a variable)

- An array constructor where each element, and bounds and strides of each implied-do are expressions whose primaries are restricted expressions
- A structure constructor whose components are restricted expressions
- An implied-do variable within an array constructor where the bounds and strides of the corresponding implied-do are restricted expressions
- A reference to one of the following transformational
functions (each argument must be a restricted expression of type
integer or character):
REPEAT SELECTED_REAL_KIND RESHAPE TRANSFER SELECTED_INT_KIND TRIM - A reference to the transformational function NULL
- A reference to one of the following inquiry functions:
BIT_SIZE NUMBER_OF_ PROCESSORS DIGITS NWORKERS EPSILON PRECISION HUGE PROCESSORS_SHAPE ILEN RADIX KIND RANGE LBOUND SHAPE LEN SIZE MAXEXPONENT TINY MINEXPONENT UBOUND Each function argument must be one of the following:

- A restricted expression
- A variable whose kind type parameter and bounds are not assumed or defined by an ALLOCATE statement, pointer assignment, or an expression that is not a restricted expression

- A reference to a specification function where each argument is a restricted expression
- Another restricted expression enclosed in parentheses

Each subscript, section subscript, and substring starting and ending point must be a restricted expression.

*Specification functions* can be used in specification
expressions to indicate the attributes of data objects. A
specification function is a pure function. It cannot have a dummy
procedure argument or be any of the following:

- An intrinsic function
- An internal function
- A statement function
- Defined as RECURSIVE

A variable in a specification expression must have its type and type parameters (if any) specified in one of the following ways:

- By a previous declaration in the same scoping unit
- By the implicit typing rules currently in effect for the scoping unit
- By host or use association

If a variable in a specification expression is typed by the implicit typing rules, its appearance in any subsequent type declaration statement must confirm the implied type and type parameters.

If a specification expression invokes an inquiry function for a type parameter or an array bound of an object, the type parameter or array bound must be specified in a prior specification statement (or to the left of the inquiry function in the same statement).

In a specification expression, the number of arguments for a function reference is limited to 255.

The following shows valid specification expressions:

MAX(I) + J ! I and J are scalar integer variables UBOUND(ARRAY_B,20) ! ARRAY_B is an assumed-shape dummy array

- On array constructors, see Section 3.4.2.4.
- On implicit typing rules, see Section 3.4.1.2.
- On structure constructors, see Section 3.2.4.
- On intrinsic functions, see Chapter 9.
- On use and host association, see Section 15.4.1.2.
- On pure procedures, see Section 8.5.1.2.

Previous Page Next Page Table of Contents