|
Department of Engineering |
|
|
Next: Calling Fortran from C
Up: Maths
Previous: Maths
Contents
Here are some opinions that experienced programmers have given for why
fortran has not been replaced by C for numerical work:
- ``C is definitely for wizards, not beginners or casual programmers.
Usually people who are heavily into numerical work are not hacker
types. They are mathematicians, scientists, or engineers. They
want to do calculations, not tricky pointer manipulations.
fortran's constructs are more obvious to use, while even simple
programs in C tend to be filled with tricks.''
- ``fortran is dangerous to use, but not as dangerous as C. For
instance, most fortran compilers have subscript checking as an
option, while I have never encountered a C compiler with this
feature. The ANSI standard for function prototypes will
give C an edge over fortran in parameter mismatch error.''
- ``There is a large body of well tested mathematical packages available
for fortran, that are not yet available in C; for example the
IMSL package. However, this situation is improving for C.''
- ``In studies done at Cray Research, they
found it took significantly longer for their programmers to learn C
and the number of errors generated in coding in C (as opposed to
fortran) was much higher.''
- ``C is hard to optimize, especially if the programmer makes full use
of C's expressivity. Newer C features (like the const keyword etc)
and new software technology are improving the situation.''
- ``Some (old) implementations of C still have too many system dependent aspects
(e.g. round up or down when dividing negative integers).''
Whether or not the switch to C is worthwhile will depend on whether
its quirks outweigh the benefits of having ``more modern"
data typing and control structures. ANSI C goes a long way to removing
the quirks but for the time being fortran is probably more portable
and will run faster on supercomputers without tweaking. On the other hand
fortran may be
harder to maintain, and it is a poor fit to algorithms that are best
expressed with types more involved than n-dimensional arrays.
When Fortran9X becomes commonplace, perhaps the decision will be
easier to make.
Next: Calling Fortran from C
Up: Maths
Previous: Maths
Contents
Tim Love
2010-04-27