Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!bloom-beacon!mit-eddie!uw-beaver!uw-june!uw-entropy!dataio!pilchuck!ssc!happym!kent From: kent@happym.UUCP (Kent Forschmiedt) Newsgroups: comp.sources.d Subject: Re: Simulation of 'alloca' -- can it be done in TurboC or MSC? Keywords: alloca Message-ID: <443@happym.UUCP> Date: 25 May 88 23:14:58 GMT References: <203@lcuxa.UUCP> Reply-To: kent@happym.UUCP (Kent Forschmiedt) Organization: Happy Man Corp. Lines: 13 I don't know about TurboC, but MSC seems to use a conventional stack structure. The alloca() that I use actually uses malloc() and free(), but saves a tag pointing to the current stack frame whenever a block is alloca()'d. When alloca() is called, it free()'s all of the blocks whose tags point below (on a down-growing stack) the current frame. I think that this scheme will work with any implementation that uses a real stack, but probably not if frames are randomly allocated from a heap, and I doubt that TurboC uses such an unconventional scheme. -- -- Kent Forschmiedt -- kent@happym.UUCP, tikal!camco!happym!kent Happy Man Corporation 206-282-9598