Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!ames!ncar!noao!arizona!naucse!jdc From: jdc@naucse.UUCP (John Campbell) Newsgroups: comp.unix.wizards Subject: Re: alloca (was vs var-len auto arrays) Message-ID: <1381@naucse.UUCP> Date: 27 Apr 89 15:02:20 GMT References: <11344@tekecs.GWD.TEK.COM> Organization: Northern Arizona University, Flagstaff, AZ Lines: 23 From article <11344@tekecs.GWD.TEK.COM>, by andrew@frip.wv.tek.com (Andrew Klossner): >> Are there architectures that will not allow you to implement this? (alloca) > No, with compiler assist you can always implement it; but its > complexity can approach that of marking all mallocs and teaching the > compiler (and longjmp) to call un_malloc_temporaries on each procedure > return. Ah, but that's the rub. What if you already have your compiler. In other words, what if you know of some nice useful software that *someone* sprinkled alloca's in AND you have some silly vendor supplied C compiler. In one case (at least) you'll have to write a stack manipulator (not in 'C') and even compile without optimizing. Often, it turns out, you'll find (with the vendor's compiler) that you're better off rewriting the offending section in order to turn optimize back on. I don't remember alloca() making it to the ANSI standard library. I hereby request that only those who write *useless* code use alloca()! :-) -- John Campbell ...!arizona!naucse!jdc CAMPBELL@NAUVAX.bitnet unix? Sure send me a dozen, all different colors.