Should I convert FORTRAN code to C?
Jim Giles
jlg at beta.UUCP
Tue Jun 7 06:58:29 AEST 1988
In article <2742 at utastro.UUCP>, rlr at utastro.UUCP (Randy Ricklefs) writes:
> We will soon start porting software from a number of different sources to a
> micro-processor-based UNIX system. Most of the code is in various dialects
> of FORTRAN. The question that arises is whether to convert all this stuff
> to a more modern language, particularly c. This suggests several questions
> which I hope the NET readers will help answer (without starting a 100-years
> war on languages ... please! :-) ):
C is not all that much more 'modern'. It was developed more recently.
Fortran is a higher-level language than C (as admitted even by Ritchie).
> 1) Are people actually initiating new projects in FORTRAN, or are they
> maintaining and porting old FORTRAN code?
Most code (new and old) in major scientifc computing environments is
Fortran, even when C is available. Whether this is because Fortran is
actually superior, or just programmer inertia is a qeustion that spurs
that 100-years war you complained about.
> 2) Does the answer to 1) change if we restrict discussion to PC's & Macs?
I write Fortran code for PC's. I don't write C code for PC's. I prefer
to write Modula-2 code for PC's. I like writing SmallTalk code for PC's,
but the executables are too slow. I know some people who write Fortran
exclusively - on PC's as elsewhere.
> 3) Is c a suitable replacement for FORTRAN in terms of mathematical capabil-
> ities and portablility?
On UNIX and UNIX-like systems, the Fortran support library is written
almost entirely in C. The only real problem with C is the lack of the
concept of an array (such references are always turned into pointers).
This makes some (admittedly rare) constructs difficult to do in C.
> 4) Are there reliable FORTRAN to c translators available under MS-DOS or UNIX
> that will allow moving over to c without re-coding the world?
Depends on what you mean by 'reliable'. If your definition doesn't
include efficiency as a requirement, there are probably some such tools.
> Thanks in advance for the help!
I'm afraid I didn't help much. Without specifics on the purpose and
size of the code you want to move, I can't really advise you on the
desirability of converting it. (Nor can anyone else.)
J. Giles
Los Alamos
More information about the Comp.lang.c
mailing list