MIXED_FORMATS Directive [ HP FORTRAN 77/iX Reference ] MPE/iX 5.0 Documentation
HP FORTRAN 77/iX Reference
MIXED_FORMATS Directive
The MIXED_FORMATS directive allows you to cause a numeric format
descriptor of a type different from the numeric list item to override the
data type of the list item.
Syntax
$MIXED_FORMATS [ON ]
[OFF]
Default Off.
Location The MIXED_FORMATS directive can appear anywhere in
your program.
Toggling/ Duration Remains in effect until another occurrence of the
MIXED_FORMATS directive changes it.
Additional Information
NOTE The MIXED_FORMATS directive is not recommended for general use. It
is an extension to the ANSI 77 standard, and programs using it are
not portable to systems without mixed formatting capability. If
list items and actual data types do not match, a floating-point
exception could occur.
When MIXED_FORMATS is on, the type of the numeric format descriptor in
input or output overrides the type of the list item. However, no type
conversion is done on the list item. The example below illustrates the
effect of the MIXED_FORMATS directive.
Example
PROGRAM mixfmts
$MIXED_FORMATS ON
INTEGER*4 i4
REAL*4 r4
CHARACTER*12 std, mixed
EQUIVALENCE (i4,r4)
C Integer type coercion
i4 = -12
100 FORMAT (I12)
WRITE (mixed,100) r4
WRITE (std,100) i4
IF (mixed .NE. std) STOP 'Failed 1'
C Real type coercion
r4 = 123.456
101 FORMAT (E12.3)
WRITE (std,101) r4
WRITE (mixed,101) i4
IF (mixed .NE. std) STOP 'Failed 2'
STOP 'Passed.'
END
MPE/iX 5.0 Documentation