[comp.os.msdos.programmer] alloca for TC 2.0 : Where and How ?

aboulene@cheddar.cs.wisc.edu (Nagi M. Aboulenein) (11/26/90)

I am trying to get the MS-DOS version of the parser generator
bison to work under Turbo C 2.0, but I need a routine called
alloca. Does anyone know where and how I can get a hold of 
that routine ?

Thanks a lot in advance,

Nagi

-----------------------------------------------------------
Nagi M. Aboulenein	(email : aboulene@cs.wisc.edu)
CS Dept., UW-Madison

kgallagh@digi.lonestar.org (Kevin Gallagher) (11/26/90)

In article <11798@spool.cs.wisc.edu> aboulene@cheddar.cs.wisc.edu (Nagi M. Aboulenein) writes:

>I am trying to get the MS-DOS version of the parser generator bison to work
>under Turbo C 2.0, but I need a routine called alloca. Does anyone know where
>and how I can get a hold of that routine ?  

The function alloca is found in BSD Unix.  The BSD man page states it
allocates the specified number of bytes of space in the stack frame of the
caller, which is released upon exit.  Later on it gives the following warning:
"alloca is machine dependent, its use is discouraged."

No MS-DOS C compiler I am aware of supports alloca.  So, you have two choices:
roll your own version of alloca OR change the bison code to get its temporary
memory allocations another way.  
-- 
----------------------------------------------------------------------------
Kevin Gallagher        kgallagh@digi.lonestar.org OR ...!uunet!digi!kgallagh
DSC Communications               OR apcihq!apcidfw!digi!kgallagh
----------------------------------------------------------------------------

bmarsh@cod.NOSC.MIL (William C. Marsh) (11/27/90)

In article <1292@digi.lonestar.org> kgallagh@digi.lonestar.org (Kevin Gallagher) writes:
>In article <11798@spool.cs.wisc.edu> aboulene@cheddar.cs.wisc.edu (Nagi M. Aboulenein) writes:
>
>>I am trying to get the MS-DOS version of the parser generator bison to work
>>under Turbo C 2.0, but I need a routine called alloca. 

>No MS-DOS C compiler I am aware of supports alloca.

Microsoft C, starting with version 5.0, supports alloca().  Does TC++?

Bill
-- 
Bill Marsh, Naval Ocean Systems Center, San Diego, CA
{arpa,mil}net: bmarsh@cod.nosc.mil
uucp: {ihnp4,akgua,decvax,dcdwest,ucbvax}!sdcsvax!nosc!bmarsh
"If you are not part of the solution, you're part of the problem..."

jeffj@mcs213h.cs.umr.edu (Jeff Jenness) (11/27/90)

In article <1292@digi.lonestar.org> kgallagh@digi.lonestar.org (Kevin Gallagher) writes:
>In article <11798@spool.cs.wisc.edu> aboulene@cheddar.cs.wisc.edu (Nagi M. Aboulenein) writes:
>
>>I am trying to get the MS-DOS version of the parser generator bison to work
>>under Turbo C 2.0, but I need a routine called alloca. Does anyone know where
>>and how I can get a hold of that routine ?  
>
<stuff deleted>

>No MS-DOS C compiler I am aware of supports alloca.  So, you have two choices:

<stuff deleted>

The Quick C compiler has the alloca function in the library and
since the library for Quick C and Microsoft C are the same then I assume
that the Microsoft C 5.1 (6.0?) also has this function.  Other of the 
DOS C compilers may also include this feature since they do attempt to
provide rather robust libraries.  Unfortunately, the Turbo C compiler
does not provide this function.  BTW, I did see an alloca function come
across the news sometime back when this same question was asked.  If 
others are interested I will see if I can dig up the author and/or the
source for the function.  The source was for the Turbo C compiler.


-- 
Jeff Jenness
University of Missouri - Rolla
jeffj@cs.umr.edu

joe@proto.COM (Joe Huffman) (11/27/90)

In article <1292@digi.lonestar.org>, kgallagh@digi.lonestar.org (Kevin Gallagher) writes:
> No MS-DOS C compiler I am aware of supports alloca.  So, you have two choices:
> roll your own version of alloca OR change the bison code to get its temporary
> memory allocations another way.  

The next release of Zortech C/C++ will have alloca().  It required special
support from the compiler so we (Walter actually) didn't put it in until
it looked like it would be a 'big deal' if we didn't have it for the 
UNIX version of the compiler.  It will now be in all versions.

-- 
joe@proto.com
FAX: 208-263-8772

ajai@sce.carleton.ca (Ajai Sehgal) (11/27/90)

TC ++ V1.01 does not support alloca(), at least its not in my Reference Guide.

Ajai

valley@uchicago (Doug Dougherty) (11/28/90)

(Probably a stupid question, but I seemed to have missed it somewhere
along the way...)

What is alloca()?  How is it different from the other alloc functions?

holtz@cascade.carleton.ca (Neal Holtz) (11/29/90)

The source (in C) for a decent imitation has appeared in gnu.emacs.sources
within the past few days.

--
Prof. Neal Holtz,  Dept. of Civil Eng.,  Carleton University,  Ottawa, Canada
Internet: holtz@civeng.carleton.ca   Tel: (613)788-5797    Fax: (613)788-3951