Should I convert FORTRAN code to C?

Gil Kloepfer Jr. gil at limbic.UUCP
Wed Jun 8 13:50:38 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! :-) ):

No problem...I hate those wars myself (being a fan of both languages!).

|>1) Are people actually initiating new projects in FORTRAN, or are they
|>	maintaining and porting old FORTRAN code?

Both.  There are still a number of research groups who are solve mathematical
problems in FORTRAN (simply because it's all they know).  This code is many
times proprietary, and the authors simply do not care to let anyone port the
existing code.

There are also a LOT of statistical (again mathematical) and graphics software
in FORTRAN which is so large that it would be a great expense to port.  It is
therefore maintained (ported if the need is there).

|>2) Does the answer to 1) change if we restrict discussion to PC's & Macs?

Yes and no.  It all depends on cost, although personally I would look more
towards porting if I had the PC/Mac marketplace in mind.

|>3) Is c a suitable replacement for FORTRAN in terms of mathematical capabil-
|>	ities and portablility?

C can do almost anything.  The question is with how much trouble.  FORTRAN,
in my book, handles mathematical stuff MUCH easier and clearly than C.
As stated in a past net-debate (no flames please if it is slightly out of
context), C lacks some of the array flexibility that FORTRAN has (although
with FORTRAN, you need to know how big the arrays are, with C you can
allocate memory at run-time).

Once you have successfully ported a FORTRAN-based mathematical procedure to
C, you can rest assured that the program is pretty-much portable (I am at
a loss for a system it wouldn't be portable to).

|>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?

I have heard of some, but I haven't used any and don't know how well they
work.

|>Thanks in advance for the help!

You're welcome.

NOTE:  The final decision on which language to use for your application
should not rest on which is more "modern."  There are FORTRAN compilers
for almost every computer in existance nowadays.  Whether you code in C
or FORTRAN should rest in the application and what it does.  Further, the
conversion costs should be considered as well as portability when making
the decision to convert.  Standard (F77) FORTRAN that isn't I/O intensive
will generally compile and run on any machine with the same compiler.  There
are people that still develop FORTRAN-based applications, but the number
is decreasing because much of the mathematical stuff can be "black-boxed"
(and possibly just that module written in FORTRAN), while the rest of the
system (including file handling and user-interface) can be more easily (and
elegantly) written in C.

|>  Randy Ricklefs  uucp:  {ut-sally, ut-ngp, noao, charm}!utastro!rlr
|>  arpa:  rlr at utastro.UTEXAS.ARPA    phone:  (512) 471-1342

+------------------------------------+----------------------------------------+
| Gil Kloepfer, Jr.                  | Net-Address:                           |
| ICUS Computer Group, Systems Dvlp. | {boulder,ihnp4,talcott}!icus!limbic!gil|
| P.O. Box 1                         | Voice-net: (516) 968-6860              |
| Islip Terrace, New York  11752     | Othernet: limbic!gil at icus.UUCP         |
+------------------------------------+----------------------------------------+



More information about the Comp.lang.c mailing list