HP Fortran Programmer's Reference (September 2007)
Expressions and assignment
Expressions
Chapter 4 93
! a named integer constant
coord(0.0,infinity) ! a structure constructor in which
! "infinity" is a named constant
(/ SQRT(x), x, x*x /) ! an array constructor in which x is a
! named real constant
x*x + 2*x*y + y*y ! a constant numeric expression where x
! and y are named constants
SUM(iterations,DIM=1) ! reference to a transformational
! intrinsic where iterations is an
! array-valued named constant
SHAPE(matrix) ! a reference to an inquiry intrinsic in
! which "matrix" is an array with
! constant bounds
Initialization expressions
An initialization expression is a more specialized form of constant expression that can
appear as the initial value in a declaration statement. Initialization expressions have these
additional restrictions:
• Exponentiation is only allowed if the second operand is an integer.
• Any subexpression within the expression must itself be an initialization expression.
• All arguments to intrinsic function references must be initialization expressions.
• Only the following transformational intrinsic functions may be referenced:
❏ REPEAT
❏ RESHAPE
❏ SELECTED_INT_KIND
❏ SELECTED_REAL_KIND
❏ TRANSFER
❏ TRIM
• Any inquiry intrinsic that is referenced may interrogate a property of an entity (such as
bounds or kind type parameter) only if the property is a constant.
• Any elemental intrinsic functions must have integer or character arguments and an
integer or character result.
Initialization expressions are required for the following: