Xref: utzoo comp.lang.fortran:919 comp.lang.c:11374
Path: utzoo!attcan!uunet!husc6!bloom-beacon!bu-cs!purdue!decwrl!labrea!sri-unix!garth!smryan
From: smryan@garth.UUCP (Steven Ryan)
Newsgroups: comp.lang.fortran,comp.lang.c
Subject: Re: Should I convert FORTRAN code to C?
Summary: Cheating.
Message-ID: <988@garth.UUCP>
Date: 16 Jul 88 21:26:47 GMT
References: <2742@utastro.UUCP> <20008@beta.UUCP> <224@raunvis.UUCP> <750@garth.UUCP> <528@philmds.UUCP> <817@garth.UUCP> <19890@watmath.waterloo.edu>
Reply-To: smryan@garth.UUCP (Steven Ryan)
Organization: INTERGRAPH (APD) -- Palo Alto, CA
Lines: 46

[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