-qddim

Category

Portability and migration

Purpose

Specifies that the bounds of pointee arrays are re-evaluated each time the arrays are referenced and removes some restrictions on the bounds expressions for pointee arrays.

Syntax

Read syntax diagramSkip visual syntax diagram
        .-noddim-.   
>>- -q--+-ddim---+---------------------------------------------><

@PROCESS:

@PROCESS DDIM | NODDIM

Defaults

-qnoddim

Usage

By default, a pointee array can only have dimension declarators containing variable names if the array appears in a subprogram, and any variables in the dimension declarators must be dummy arguments, members of a common block, or use- or host-associated. The size of the dimension is evaluated on entry to the subprogram and remains constant during execution of the subprogram.

With the -qddim option:
  • The bounds of a pointee array are re-evaluated each time the pointee is referenced. This process is called dynamic dimensioning. Because the variables in the declarators are evaluated each time the array is referenced, changing the values of the variables changes the size of the pointee array.
  • The restriction on the variables that can appear in the array declarators is lifted, so ordinary local variables can be used in these expressions.
  • Pointee arrays in the main program can also have variables in their array declarators.

Examples

@PROCESS DDIM
INTEGER PTE, N, ARRAY(10)
POINTER (P, PTE(N))
DO I=1, 10
   ARRAY(I)=I
END DO
N = 5
P = LOC(ARRAY(2))
PRINT *, PTE   ! Print elements 2 through 6.
N = 7          ! Increase the size.
PRINT *, PTE   ! Print elements 2 through 8.
END