24.05.2014 Views

XL Fortran Enterprise Edition for AIX : User's Guide - IBM

XL Fortran Enterprise Edition for AIX : User's Guide - IBM

XL Fortran Enterprise Edition for AIX : User's Guide - IBM

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

-qddim Option<br />

Syntax<br />

-qddim | -qnoddim<br />

DDIM | NODDIM<br />

Specifies that the bounds of pointee arrays are re-evaluated each time the arrays<br />

are referenced and removes some restrictions on the bounds expressions <strong>for</strong><br />

pointee arrays.<br />

Rules<br />

By default, a pointee array can only have dimension declarators containing<br />

variable names if the array appears in a subprogram, and any variables in the<br />

dimension declarators must be dummy arguments, members of a common block,<br />

or use- or host-associated. The size of the dimension is evaluated on entry to the<br />

subprogram and remains constant during execution of the subprogram.<br />

With the -qddim option:<br />

v The bounds of a pointee array are re-evaluated each time the pointee is<br />

referenced. This process is called dynamic dimensioning. Because the variables in<br />

the declarators are evaluated each time the array is referenced, changing the<br />

values of the variables changes the size of the pointee array.<br />

v The restriction on the variables that can appear in the array declarators is lifted,<br />

so ordinary local variables can be used in these expressions.<br />

v Pointee arrays in the main program can also have variables in their array<br />

declarators.<br />

Examples<br />

@PROCESS DDIM<br />

INTEGER PTE, N, ARRAY(10)<br />

POINTER (P, PTE(N))<br />

DO I=1, 10<br />

ARRAY(I)=I<br />

END DO<br />

N = 5<br />

P = LOC(ARRAY(2))<br />

PRINT *, PTE ! Print elements 2 through 6.<br />

N = 7 ! Increase the size.<br />

PRINT *, PTE ! Print elements 2 through 8.<br />

END<br />

<strong>XL</strong> <strong>Fortran</strong> Compiler-Option Reference 147

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!