Should I convert FORTRAN code to C?

Steven Ryan smryan at garth.UUCP
Sat Jun 18 05:33:03 AEST 1988


First of all I agree with Dijkstra with respect to Fortran. I feel the
challenge designing a new language that can be Fortran at its own game,
which C does not do.

>  Now here there seems to be a little misunderstanding.  I have never
>understood why Fortran users keep saying that array indexing is awkward
>in C.  This is probably because they find the idea of having to allocate
>memory for an array rather repulsive.

A Fortran compiler is permitted to allocate all arrays statically, before
compilation, and many do this. Also Fortran subroutine are not required to
be recursive and hence do not need a procedure frame. All allocation can be
done in the compiler and the runtime overhead can be zero.

Also it is easy for programmer to modify the array base address to implement
nonzero lower bounds. It is also easy for the compiler. I suspect Fortran
programmers know alot less about dope vectors biased base addresses and that
ilk than C programmers (scientists and engineers vs. computer science and
system programmers).

>		i) Argument are passed by value, which translates to
>		   the fact that to let a subroutine change a variable
>		   you have to specify it (by passing its adress).

And simplifies defined/referenced detection for an optimiser.

>	       ii) You can define your own data structures,

Apparently some Fortran programmers equivalence different typed arrays to
create structures (shudder).

    Nature is immacuately fair and implacably cruel -- Sara James.



More information about the Comp.lang.c mailing list