An initialization expression must evaluate at compile time to a constant. It is used to specify an initial value for an entity.
In an initialization expression, each operation is intrinsic and each operand is one of the following:
BIT_SIZE | MINEXPONENT |
DIGITS | PRECISION |
EPSILON | RADIX |
HUGE | RANGE |
ILEN | SHAPE |
KIND | SIZE |
LBOUND | TINY |
LEN | UBOUND |
MAXEXPONENT |
Each function argument must be one of the following:
REPEAT | SELECTED_REAL_KIND |
RESHAPE | TRANSFER |
SELECTED_INT_KIND | TRIM |
Each subscript, section subscript, and substring starting and ending point must be an initialization expression.
In an initialization expression, the exponential operator (**) must have a power of type integer.
If an initialization 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).
The following examples show valid and invalid initialization (constant) expressions:
Valid | |
-1 + 3 | |
SIZE(B) | ! B is a named constant |
7_2
| |
INT(J,
4) | ! J is a named constant |
SELECTED_INT_KIND (2) |
|
Invalid | Explanation |
SUM(A)
| Not an allowed function. |
A/4.1 - K**1.2 | Exponential does not have integer power (A and K are named constants). |
HUGE(4.0) | Argument is not an integer. |
For More Information: