Should I convert FORTRAN code to C?
Steven Ryan
smryan at garth.UUCP
Sun Jul 17 07:26:47 AEST 1988
[Suddenly, a pittrap opens beneath our hero's toes. From the darkness are
heard faint cries of `my mainframe is bigger than your mainframe.' He neatly
pirouettes out of danger.]
>Then again depending on the machine archetecture, access to something
>mapped to a stack frame may be cheaper and faster than statically
>...
I see three possibilities:
(1) On the hardware, static nonrecursive code is faster than stack-based
recursive code. Fortran wins; C loses.
(2) Static and stack code are equally well supported. Fortran wins; C wins.
(3) Stack code is faster than nonrecursive static code. C wins. Also, Fortran
wins. Although a standard conforming *program* cannot be recursive, the
implementation is unrestricted. A compiler can map a program into static
nonrecursive code, stack-based recursive code, heap-based multithreaded
recursive and reentrant code, or anything else as long as it accepts
nonrecursive code.
Is this cheating? Well.....
This is a case of underconstraining the solution so that the implementor has
greater freedom of action. A Fortran compiler writer has that many fewer
constraints than C hence that much more freedom. The Fortran compiler may
not be better but certainly will not be worse.
This is similar to the alias ban in Fortran. [NO! I'm starting that again.
This is just a fer instance, not an agreement/disagreement.] The Fortran
optimiser can depend on the alias ban to produce better code than C. Doesn't
have to, and it won't effect a conforming program either way.
In general, the fewer constraints that are put on a compiler, or any other
program, the more freedom the programmer has for getting any particular
implementation fast.
Hafa an godne daege.
sm ryan
----------------------------------------
Bucky Bug sez:
Poor Mother Earth..
No one takes care of her in her old age..
- Odd Bodkins
More information about the Comp.lang.c
mailing list