alloca (was back to the (ivory) tower)

Gary Allen gallen at apollo.uucp
Tue Jun 21 00:49:00 AEST 1988


In article <1169 at mcgill-vision.UUCP> mouse at mcgill-vision.UUCP (der Mouse) writes:
>In article <16100 at brl-adm.ARPA>, rbj at icst-cmr.arpa (Root Boy Jim) writes:
>[Other attributions are Neil Webber <nw at palladium.uucp> and
>ted%nmsu.csnet at 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."



More information about the Comp.unix.wizards mailing list