Path: utzoo!utgpu!watserv1!watmath!att!att!linac!uwm.edu!zaphod.mps.ohio-state.edu!samsung!uunet!taumet!steve From: steve@taumet.com (Stephen Clamage) Newsgroups: comp.lang.c Subject: Re: alloca() portability Keywords: portability, alloca Message-ID: <499@taumet.com> Date: 2 Nov 90 16:24:11 GMT References: <9032@ncar.ucar.edu> Distribution: na Organization: Taumetric Corporation, San Diego Lines: 26 russ@groucho.ucar.edu (Russ Rew) writes: >Comments in Doug Gwyn's "(mostly) portable public-domain implementation" of >alloca say > It should work under any C implementation that uses an > actual procedure stack (as opposed to a linked list of > frames). >What common platforms do not provide an alloca or cannot use Doug Gwyn's >alloca because they don't use a procedure stack? In other words, if we >decide to use alloca despite the warnings about its portability, what >platforms are we precluding? There is more to it than the target machine. Some compilers get a performance win by omitting frame pointers and leveling the stack only when actually needed. The compiler keeps track of the top of the stack, and parameter and local variable references are relative to the current TOS rather than to the FP. Upon return from a function, the stack is not necessarily popped -- it gets leveled only when different flow paths converge. With such a stack management strategy, alloca cannot be implemented as a library routine -- it would have to be built into the compiler. -- Steve Clamage, TauMetric Corp, steve@taumet.com