Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!uwm.edu!bionet!ucselx!vaitl From: vaitl@ucselx.sdsu.edu (Eric Vaitl) Newsgroups: comp.os.msdos.programmer Subject: Re: alloca() for Turbo C Message-ID: <1991Mar20.054928.24101@ucselx.sdsu.edu> Date: 20 Mar 91 05:49:28 GMT References: <200@esun49.nms.gdc.portal.com> Sender: vaitl@ucselx (Eric Vaitl) Organization: San Diego State University Computing Services Lines: 24 >Does anyone know where I can get a PD version of alloca() for Turbo C? >I'm trying to compile some GNU stuff which uses it. > >Thanks! >-- >Jeff Chadbourne >chadbourne@nms.gdc.portal.com I got this from one of the versions of Bison floating around: /***********************************************************************\ | The following gives the definition of a macro (alloca) that allocates | | space like malloc EXCEPT that it is allocated from the stack and does | | not have to be freed. The allocated space will automatically disap- | | pear when the function that allocated the space exits. | \***********************************************************************/ #if !defined(alloca) #if defined(__COMPACT__) || defined(__LARGE__) || defined(__HUGE__) #define alloca(i) (_SP-=((i+1)&0xFFFE),(void *)(((unsigned long)_SS<<16)|_SP)) #else #define alloca(i) (_SP-=((i+1)&0xFFFE),(void *)_SP) #endif #endif