Path: utzoo!attcan!uunet!husc6!think!bloom-beacon!mit-eddie!apollo!gallen From: gallen@apollo.uucp (Gary Allen) Newsgroups: comp.unix.wizards Subject: Re: alloca (was back to the (ivory) tower) Message-ID: <3cc63cbf.4bee@apollo.uucp> Date: 20 Jun 88 14:49:00 GMT References: <16100@brl-adm.ARPA> <1169@mcgill-vision.UUCP> Reply-To: gallen@gallen.UUCP (Gary Allen) Organization: Apollo Computer, Chelmsford, MA Lines: 26 In article <1169@mcgill-vision.UUCP> mouse@mcgill-vision.UUCP (der Mouse) writes: >In article <16100@brl-adm.ARPA>, rbj@icst-cmr.arpa (Root Boy Jim) writes: >[Other attributions are Neil Webber and >ted%nmsu.csnet@relay.cs.net, but it's not clear who wrote what.] >> 2) function calling conventions -- unless alloca() is >> built into the C compiler it has to implemented as >> a C callable function, not an inline stack adjustment. >> It's hard to figure out exactly what you mean here. > >I would imagine that he means more or less what he said. If alloca() >is not specially known to the compiler (ie, "built in"), it will >compile into a call to a function. It therefore can't be an inline >stack adjustment. That's all. (The function called will wind up >adjusting the stack, yes, but that's not "inline".) Not necessarily. If your C compiler supports the 'asm' statement, it is possible to implement 'alloca' as a macro to adjust the stack pointer and then jam its contents into a register variable. It obviously ain't pretty and it obviously ain't portable, but it does work. Gary Allen Apollo Computer Chelmsford, MA {decvax,umix,yale}!apollo!gallen "I don't need life, I'm high on drugs."