Fortran 77 is probably the dominant current Fortran dialect,
replacing earlier standards such as Fortran IV and Fortran 66[Note 6]. There are several dialects of Fortran, containing
various vendors' language extensions, but the only extensions which
are usually portable are those in VAX Fortran, which includes the
enddo
statement for terminating do-loops, and the
%val()
function which is necessary to intermix Fortran
and C code (see Section 2.5.4).
The standards document for Fortran 77 is not exactly bedtime reading, but can be quite useful when you have forgotten details of syntax, especially to make sure what you are writing is correct rather than just allowed by the compiler you are using at the time. As an introduction to Fortarn 77, I've heard good things about [metcalf85]. [MBT]
An important deficiency in Fortran is its lack of any
standard way of dynamically allocating memory (as opposed
to allocating arrays to be a fixed size at compile time).
The Starlink CNF library, SUN/209 is intended to make
this reasonably easy, and includes a brief discussion of
the underlying mechanism. This is rather a can of worms,
but the essential technique is to write a bit of C which
obtains a pointer to a block of memory via a call
malloc
, return that pointer to the Fortran
program as an integer, then use %VAL()
to
supply that integer as an argument to a function which is
expecting an array. This is non-standard (and not likely
to become standard, now that Fortran 90 includes its own
mechanisms for dynamic memory allocation), but it is a
well-established technique and therefore probably more
portable than you have any right to expect.
There is a large number of introductions to Fortran, but not, I believe, a single preeminent one. The Starlink application programming standard, SGP/16, is a collection of programming style guidelines for Fortran, and includes further references.
There is a reasonable amount of online information on
Fortran, which is well-covered at the `Fortran Market'
(<http://www.fortran.com/fortran/info.html>
),
which includes several Fortran FAQs.