Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!samsung!munnari.oz.au!uhccux!mikem From: mikem@uhccux.uhcc.hawaii.edu (Mike Morton) Newsgroups: comp.sys.mac.programmer Subject: Re: alloca for Think C 4.0: here it is Keywords: alloca Think C Message-ID: <6521@uhccux.uhcc.hawaii.edu> Date: 9 Feb 90 05:38:06 GMT References: <11376@attctc.Dallas.TX.US> Reply-To: mikem@uhccux.UUCP (Mike Morton) Organization: University of Hawaii Lines: 19 Jay Finger writes: >pascal void *alloca(long size) = > { > 0x201F, /* MOVE.L (SP)+,D0 ;get size */ > 0x5680, /* ADDQ.L #3,D0 ;make it a multiple of 4 */ > 0x0240, 0xFFFC, /* ANDI.W #-4,D0 */ > 0x9FC0, /* SUB.L D0,SP ;allocate it */ > 0x2F0F /* MOVE.L SP,-(SP) ;return value on stack */ > }; Since the "calling" C code has already done something like a: SUBQ #4, SP to make room for a Pascal-style returned value, then isn't this allocating 4 bytes more than needed? I think changing -(SP) to just (SP) would work, but haven't tried it. -- Mike Morton // P.O. Box 11299, Honolulu, HI 96828, (808) 676-6966 HST Internet: mikem@uhccux.uhcc.hawaii.edu (anagrams): Mr. Machine Tool; Ethical Mormon; Chosen Immortal; etc.