Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!uunet!sco!seanf From: seanf@sco.COM (Sean Fagan) Newsgroups: comp.lang.c Subject: Re: alloca() portability Message-ID: <8789@scolex.sco.COM> Date: 16 Nov 90 09:29:31 GMT References: <1990Nov09.233527.7489@chinet.chi.il.us> <27608@mimsy.umd.edu> Sender: news@sco.COM Organization: The Santa Cruz Operation, Inc. Lines: 27 In article paulb@ssd.csd.harris.com (Paul Beusterien) writes: >There can be major time and space gains by using alloca instead of malloc >and free. It is obviously faster to adjust a stack pointer than to search >an available list and free it back up. ``Stack pointer''? What is a ``stack pointer''? On some of my favorite machines, there is no concept of something called a ``stack.'' (Well, actually, the Cyber has a "stack," but its "stack" is actually a 10-word instruction queue.) I just tried a small program, and using alloca() caused a coredump. You know, I think you're right: that saved me *so* much time, space, and effort! I'm *so* glad I used it! (Note for the curious: if trying to generate code that will break, it is ofttimes helpful to know the compiler somewhat intimately 8-).) Lessee... we've had Chris and Doug denounce alloca(), but I haven't seen anything from Henry (yet? I suspect he would also denounce it). Dennis? -- -----------------+ Sean Eric Fagan | "*Never* knock on Death's door: ring the bell and seanf@sco.COM | run away! Death hates that!" uunet!sco!seanf | -- Dr. Mike Stratford (Matt Frewer, "Doctor, Doctor") (408) 458-1422 | Any opinions expressed are my own, not my employers'.