It was thus said that the Great Chris M once stated:
FORTRAN survives,
nay, FLOURISHES, thanks
to a superior investmental inertia."
No, I think some people are just too lazy to learn a
new language LOL LOL. Actually if all the FORTRAN
code, libraries and all, were transformed into say C
or even C++ overnight, would the world be a better
place?
Nope. There are certain optimizations you can do in Fortran that you
can't do in C because of the language semantics. Given the hypothetical
code:
int y;
int foo(int *px)
{
int a;
int b;
int c;
a = y;
*px = a * 2;
c = y;
...
}
The compiler is hampered with this code. It would be much faster if the
compiler could do:
move.w (y),d0
move.w d0,a(sp)
move.w d0,c(sp)
add.w d0,d0
move.w d0,[px(sp)]
(and if my syntax is a bit off, please forgive me, I don't have my 68k
references handy right now)
But the C compiler can't do that because it can't know if px points to y.
So it has to be rather conservative in code generation:
move.w (y),d0
move.w d0,a(sp)
add.w d0,d0
move.w do,[px(sp)]
move.w (y),d0
move.w d0,c(sp)
Not much difference, but when you're writing code that takes a year to run,
it does add up.
Fortran also supports complex numbers. It may even support vector
operations like (borrowing a C like-syntax):
double A[MAXSIZE];
double B[MAXSIZE];
double C[MAXSIZE];
C = A + B;
which does the equivilent of:
for (i = 0 ; i < MAXSIZE ; i++)
C[i] = A[i] + B[i];
or
for (pa = A , pb = B , pc = C , i = 0 ; i < MAXSIZE ; i++)
*pc++ = *pa++ + *pb++;
or whatever is faster for the CPU architecture.
I do know that the newer C standard (C99) has attempted to address some of
these issues, but not all of them.
-spc (Now? Where is my Numerical Recipies book again?)