Path: utzoo!attcan!uunet!husc6!mailrus!cornell!uw-beaver!uw-june!pardo From: pardo@june.cs.washington.edu (David Keppel) Newsgroups: comp.lang.c Subject: Re: How many stacks? (WAS: alloca(), #if, and other controversial things...) Message-ID: <5542@june.cs.washington.edu> Date: 24 Aug 88 03:00:13 GMT References: <219@lakart.UUCP> Reply-To: pardo@uw-june.UUCP (David Keppel) Organization: U of Washington, Computer Science, Seattle Lines: 24 dg@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@cs.washington.edu {rutgers,cornell,ucsd,ubc-cs,tektronix}!uw-beaver!june!pardo