C vs. FORTRAN

Doug Gwyn gwyn at smoke.BRL.MIL
Fri Aug 4 11:50:58 AEST 1989


In article <3288 at ohstpy.mps.ohio-state.edu> SMITHJ at ohstpy.mps.ohio-state.edu writes:
>What are the reasons for using FORTRAN over C?

The main legitimate one is that there are large libraries of numerical
software on tap for Fortran users, less so for C users.

Around here the main reason is, or was, that scientists and engineers
are doing their own programming (for whatever reason) and having spent
considerable effort learning Fortran, which seems "good enough" to them,
they have no desire to learn C.  They may have a desire for assistance
from genuine computing professionals, but they're not being staffed
for that.

>I have heard claims that the code is easier to optimize ...
>...  My experience is that this is pure bu****it.

C has some features that make optimization more difficult and less
complete, the primary one being the potential for pointer aliasing.
Although Fortran can also have aliasing, the problem is more sever
for C.  In spite of the difficulties, there are some extremely good
optimizing C compilers in existence.

>Is it likely that C runs slower--on say the VAX--because it is only in
>version 2.4 whereas the FORTRAN compiler is at version 90+ (i.e. fewer
>man hours have been put into developing mainframe C compilers)?

Older UNIX distributions included a Fortran implementation that
(justifiably) received far less attention than the C environment;
certainly there, relative compiler quality was a factor -- although
in the opposite direction!  The demand for hyper-efficient C code
generation is relatively recent, whereas Fortran users have always
been sensitive to code "efficiency".  Many computer vendors these
days use essentially the same code generator for all their Algol-
like language compilers.

The odds are pretty good that somebody asking about relative code
efficiency is worrying about the wrong issues in choosing a
programming language.



More information about the Comp.lang.c mailing list