alloca() portability
Sean Fagan
seanf at sco.COM
Fri Nov 16 20:29:31 AEST 1990
In article <PAULB.90Nov12131357 at hcx2.ssd.csd.harris.com> paulb at 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 at 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'.
More information about the Comp.lang.c
mailing list