REAL Directive

General Compiler Directive: Specifies the default real kind.

Syntax

cDEC$ REAL:{ 4 | 8 }

c
Is one of the following: C (or c), !, or *. (See Syntax Rules for General Directives.)

Rules and Behavior

The REAL directive selects a size of 4 or 8 bytes (KIND=4 or KIND=8) for default real numbers. When the directive is in effect, all default real variables are of the kind specified in the directive. Only numbers specified or implied as REAL without KIND are affected.

The REAL directive can appear only at the top of a program unit. A program unit is a main program, an external subroutine or function, a module, or a block data program unit. REAL cannot appear between program units, or at the beginning of internal subprograms. It does not affect modules invoked with the USE statement in the program unit that contains it.

The following form is also allowed: !MS$REAL:{4 | 8}

Compatibility

CONSOLE STANDARD GRAPHICS QUICKWIN GRAPHICS WINDOWS DLL LIB

See Also: REAL, INTEGER Directive, General Compiler Directives

Example

 REAL r              ! a 4-byte REAL
 WRITE(*,*) KIND(r)
 CALL REAL8( )
 WRITE(*,*) KIND(r)  ! still a 4-byte REAL
                     !   not affected by setting in subroutine
 END
 SUBROUTINE REAL8( )
   !DEC$ REAL:8
   REAL s ! an 8-byte REAL
   WRITE(*,*) KIND(s)
 END SUBROUTINE