![]() ![]() | Fortran 77 Notes |
![]() ![]() |
This page is a collection of things to watch out when writing Fortran 77 code. These are generally non-standard bits of code which are treated differently by the compilers we have to deal with. Thanks to Clive Page at Leicester for supplying some of these.
.AND.
etc. operate
in a bitwise manner on BYTE
variables in DEC compilers (ie.
VMS, Ultrix and OSF). However Sun compilers treat this as logical operation
and return 0 or 1. You cannot get around this by casteing the BYTE's to
integers and using the IAND
etc intrinsic functions portably
because the conversion functions are not supported for
BYTEs on DEC machines! Putting in multiplication by 1 works but leaves you
open to optimiser behaviour. ASTERIX gets around this by providing
functions in astlib
to support bitwise byte operations
portably.
*(*)
(which is always the best thing way of
declaring dummy args) the argument cannot be used as an argument
of the //
operator in anything except in an
assignment statement.
UNION
definitions, for which the Solaris Fortran compiler
has difficulty generating correct code.
STRUCTURE /PARENT/ STRUCTURE CHILD(2) INTEGER CHILD_VAR END STRUCTURE INTEGER PARENT_VAR END STRUCTUREor
STRUCTURE /CHILD/ INTEGER CHILD_VAR END STRUCTURE STRUCTURE /PARENT/ RECORD /CHILD/ CHILD(2) INTEGER PARENT_VAR END STRUCTUREWe have found that only the 2nd version is implemented correctly in the Solaris Fortran compiler (V2.0.1).