HP Fortran Programmer's Guide (September 2007)
Migrating to HP Fortran
Incompatibilities with HP FORTRAN 77
Chapter 10 217
DOUBLE PRECISION x = 3.1415926535
will initialize x to only 32 bits worth of the constant because it interprets the constant as
single precision. Under HP Fortran, a constant must have a D exponent or a KIND suffix to be
interpreted as double precision.
In programs that use double precision exclusively, you should consider using the
+real_constant=double option, which causes real constants to default to double precision.
For more information, refer to “Controlling data storage” on page 97.
Intrinsic functions
The Fortran 90 standard has introduced new intrinsics that may collide with function or
subroutine names in FORTRAN 77 code. You can resolve such collisions by declaring all
procedures that you have written—but especially those that have the same name as
nonstandard HP Fortran intrinsics—with the EXTERNAL statement. For a list of nonstandard
HP Fortran intrinsics, see Table 11-4 on page 236.
Also, HP FORTRAN 77 allows intrinsics to accept a wider variety of argument types than
HP Fortran does. For example, in HP FORTRAN 77 the MAX and MIN intrinsics can take
arguments of different types, while HP Fortran follows the standard and requires all
arguments to be of the same type. The HP Fortran version of the TIME intrinsic takes a
CHARACTER* argument; it will not accept an integer. Other intrinsics are similarly affected.
For a full description of all HP Fortran intrinsics, refer to the HP Fortran Programmer's
Reference.
Procedure calls and definitions
When defining a procedure or making a procedure call, HP Fortran makes the following
requirements, which HP FORTRAN 77 overlooks:
• Function references must include the parentheses for the argument list, even when no
arguments are supplied. For example, if foo is a user-defined function returning
CHARACTER*10, HP FORTRAN 77 permits LEN(foo) and returns 10. HP Fortran requires
LEN(foo()).
• The argument list must not contain any extraneous commas, which HP FORTRAN 77
allows as “placeholders” for missing arguments. For example, the following is acceptable
to f77 but not f90:
call foo (a,)
To specify optional arguments in HP Fortran, use the OPTIONAL statement.
• The SYSTEM INTRINSIC directive, by which HP FORTRAN 77 determines interfaces, is
not supported by HP Fortran.