the f2c program

Flint Pellett flint at gistdev.gist.com
Tue Aug 14 01:35:39 AEST 1990


f2c seems to do a reasonable job of translating, if you don't want to
have to work with/on the resulting C code, but only need to compile it.
The worst feature of f2c (IMHO) is that it moves all your data up to the
top of the file, leaving the comments (that explain the data) where they
were.  Example: if your Fortran code starts with 40 lines that look roughly
like this:

c	Data used as arguments to foo() function:
	data abc,def,ghi/1,2,3/
c	Data used as arguments to bar() function:
	data uvw,xyz/4,5/

it gets turned into gibberish because you end up with 20 lines of the
variables and values, followed by 20 lines of comments to explain them:
But you no longer know know what data element each comment refers to,
especially when there are variable numbers of lines of comments about
each data element/group.

A second thing that would be nice to see improved would be to have an
option to not screw up the comments.  (They seem to insist on reformatting
the comments, chopping them off to about a 70 column line, so that what
was a 1 line comment gets broken into two lines that are easily recombinable
back into 1- but who wants to have to manually recombine thousands of lines
of comments to make them readable?  I've also noted that it always breaks
the comments at a quote mark for some reason, so contractions in your
comments don't (<-like that) stay together: the line ends up like this:

/* comments don
't (<-like that) stay together: the line ends up like
this */

It ought to just take a block of comments, stick a /* line before them,
convert the leading "c" into a *, and stick a */ line after them, and
not reformat them at all, except maybe for searching for the random
/* or */ within the FORTRAN comment.
-- 
Flint Pellett, Global Information Systems Technology, Inc.
1800 Woodfield Drive, Savoy, IL  61874     (217) 352-1165
uunet!gistdev!flint or flint at gistdev.gist.com



More information about the Comp.lang.c mailing list