[comp.sys.ibm.pc] Processor Stack/Turbo C

terrell@druhi.ATT.COM (Mr. Terrell) (09/14/88)

How does one allocate a larger-than-default processor stack with Turbo C?
I have a recursive program that requires a large stack...  

Thanks in advance,


Eric Terrell

att!druhi!terrell

bobmon@iuvax.cs.indiana.edu (RAMontante) (09/16/88)

terrell@druhi.UUCP (TerrellE) writes:
>How does one allocate a larger-than-default processor stack with Turbo C?

The variable _stklen is defined in dos.h as

	extern unsigned _stklen;

It defaults to 4K words; the minimum is 128 words.  You choose your size by

	_stklen = 1048576;	/* or whatever size you want... */

There is also a variable _heaplen for controlling heap size.
See p.53 of the v1.5 upgrade manual; also mentioned in the read.me file
of later copies of v1.0, and I expect it's mentioned in the 2.0
documentation.

-- 
--    bob,mon			(bobmon@iuvax.cs.indiana.edu)
--    "Aristotle was not Belgian..."	- Wanda

ralf@b.gp.cs.cmu.edu (Ralf Brown) (09/17/88)

In article <12769@iuvax.cs.indiana.edu> bobmon@iuvax.UUCP (RAMontante) writes:
}The variable _stklen is defined in dos.h as
}	extern unsigned _stklen;
}
}It defaults to 4K words; the minimum is 128 words.  You choose your size by

4K *bytes*, minimum is 256 bytes.  Maximum is 64K bytes, so the below WILL NOT
WORK.

}	_stklen = 1048576;	/* or whatever size you want... */

--
{harvard,uunet,ucbvax}!b.gp.cs.cmu.edu!ralf -=-=- AT&T: (412)268-3053 (school) 
ARPA: RALF@B.GP.CS.CMU.EDU |"Tolerance means excusing the mistakes others make.
FIDO: Ralf Brown at 129/31 | Tact means not noticing them." --Arthur Schnitzler
BITnet: RALF%B.GP.CS.CMU.EDU@CMUCCVMA -=-=- DISCLAIMER? I claimed something?
-- 
{harvard,uunet,ucbvax}!b.gp.cs.cmu.edu!ralf -=-=- AT&T: (412)268-3053 (school) 
ARPA: RALF@B.GP.CS.CMU.EDU |"Tolerance means excusing the mistakes others make.
FIDO: Ralf Brown at 129/31 | Tact means not noticing them." --Arthur Schnitzler
BITnet: RALF%B.GP.CS.CMU.EDU@CMUCCVMA -=-=- DISCLAIMER? I claimed something?

bobmon@iuvax.cs.indiana.edu (RAMontante) (09/18/88)

ralf@b.gp.cs.cms.edu sez:
>}The variable _stklen is defined in dos.h as
>}	extern unsigned _stklen;
>}
>}It defaults to 4K words; the minimum is 128 words.  You choose your size by
>
>4K *bytes*, minimum is 256 bytes.  Maximum is 64K bytes, so the below WILL NOT
>WORK.

Thank you.  I was using the manual's terms, and it states a 128 word
minimum.  Then when it says "The default stack size is 4K." it doesn't
say whether it's talking words or bytes, and I just assumed it was
using consistent units.  (Actually, I've only used this when I wanted
more stack, and I just automatically specify bytes; the minimum is
beneath me, so to speak.)

>}	_stklen = 1048576;	/* or whatever size you want... */

Sorry 'bout that, I should have put a smiley here.  This was meant to be
an absurdly large number.  Haven't you ever wanted to devote your
entire address space to the stack?  :-)  (BTW:  I *did* give this value
in bytes.  Okay, so some of you have more address space than 1 Meg.
Phfffffft.)

Write-protect smileys.  Apply as needed --> :-) 8-) :*) :-> :-/ X-) :-) :-)
-- 
--    bob,mon			(bobmon@iuvax.cs.indiana.edu)
--    "Aristotle was not Belgian..."	- Wanda