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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Examples<br />

In the following example, note how variables, literal constants, intrinsics,<br />

arithmetic operators, and input/output operations all handle the changed default<br />

integer size.<br />

@PROCESS INTSIZE(8)<br />

PROGRAM INTSIZETEST<br />

INTEGER I<br />

I = -9223372036854775807 ! I is big enough to hold this constant.<br />

J = ABS(I) ! So is implicit integer J.<br />

IF (I .NE. J) THEN<br />

PRINT *, I, ’.NE.’, J<br />

END IF<br />

END<br />

The following example only works with the default size <strong>for</strong> integers:<br />

CALL SUB(17)<br />

END<br />

SUBROUTINE SUB(I)<br />

INTEGER(4) I ! But INTSIZE may change "17"<br />

! to INTEGER(2) or INTEGER(8).<br />

...<br />

END<br />

If you change the default value, you must either declare the variable I as<br />

INTEGER instead of INTEGER(4) or give a length to the actual argument, as<br />

follows:<br />

@PROCESS INTSIZE(8)<br />

INTEGER(4) X<br />

PARAMETER(X=17)<br />

CALL SUB(X)<br />

CALL SUB(17_4)<br />

END<br />

! Use a parameter with the right length, or<br />

! use a constant with the right kind.<br />

Related In<strong>for</strong>mation<br />

See “-qrealsize Option” on page 222 and Type Parameters and Specifiers in the <strong>XL</strong><br />

<strong>Fortran</strong> <strong>Enterprise</strong> <strong>Edition</strong> <strong>for</strong> <strong>AIX</strong> Language Reference.<br />

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

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

Saved successfully!

Ooh no, something went wrong!