Should I convert FORTRAN code to C?

Alan T. Bowler [SDG] atbowler at watmath.waterloo.edu
Fri Jul 15 09:40:06 AEST 1988


In article <817 at garth.UUCP> smryan at garth.UUCP (Steven Ryan) writes:
>
>By only offering static allocation, the compiler does not have to support
>any overhead at all. A C program must keep the stack pointer correctly
>aligned and rest of the protocol straight even if it doesn't use the stack
>because somebody it calls may use the stack. Similarily, in supporting
>recursion, the stack has to be maintained in case some called program needs
>the stack. Further, supporting recursion means all automatic variables must
>be mapped into the stack because the procedure may recurse indirectly.
>Forbidding recursion means the compiler can map automatic variables into
>static areas.
>

Then again depending on the machine archetecture, access to something
mapped to a stack frame may be cheaper and faster than statically
allocated memory.  It depends on the addressing mechanisms of the
machine, and the skill of whoever does the stack design and call/return
mechanism.  The blanket statement that stack accesses were more
expensive than static memory accesses was true in the past,
but stopped being universally true sometime in the 1960's.  As
hardware caches become more important, and as addressing extensions
are added to increase the address space of existing architectures,
the tradoff between stack and static allocation changes.



More information about the Comp.lang.c mailing list