How many stacks? (WAS: alloca(), #if, and other controversial things...)

David Keppel pardo at june.cs.washington.edu
Wed Aug 24 13:00:13 AEST 1988


dg at lakart.UUCP (David Goodenough) writes:
>[ suggestion: always need AT LEAST ONE stack for recursive languages ]

Um, er, ah, well...

Some C implementations, I'm told (haven't seen them personally) on
older architectures (for which there is no explicit stack support)
implement recursion by allocating call frames off of the heap and
explicitly freeing them when done.

I'd be willing to gamble a few alfalfa sprouts that Zeta-C uses the
underlying hardware management for stacks, and if the underlying
hardware supports non-LIFO stacks (e.g., Symbolics), then that's what
gets used.

Memories from theory: recursion and iteration are equivalent.  =>
Proof by intimidation that any machine that can run iterative programs
(which you will agree do not *need* stacks) can also run recursive
programs, given a sufficient set of transformations.

		    ;-D on  ( Damn kids )  Pardo
-- 
		    pardo at cs.washington.edu
    {rutgers,cornell,ucsd,ubc-cs,tektronix}!uw-beaver!june!pardo



More information about the Comp.lang.c mailing list