🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.msdos.programmer
Article #682

Re: Stack Overflow in Turbo C

#682
From: haydedr
Date: Sun, 04 Oct 1992 17:12
30 lines
1450 bytes
In article <WAYNE.92Oct4013500@dew.cs.odu.edu>, wayne@dew.cs.odu.edu (C Wayne Huling) writes:
> I am using turbo C, and am having a stack overflow, my books tell me how to 
> find the problem, but now how to solve the problem.  Any suggestions?


Well, you could increase your stack size.  To do this in Turbo C++
version 3.0 for DOS (I'll bet it's the same, though, for all versions
of Turbo C), you have to set the global variable _stklen, declared in 
DOS.H, to a new value.  For instance,

/*-----------------------------------*/
#include <stdio.h>
#include <dos.h>


extern unsigned _stklen = 543210U;

int main(void)
{
   printf("The stack size is %u\n", _stklen);
   return 0;
}
/*-----------------------------------*/

That should do it.  If you increase your stack to the size I used
above, and you still overflows, then you may want to check your code
for some infinite loops or other things of that nature.

Cheers,
Ross Hayden                          HAYDEDR@WKUVX1.BITNET
Technical Details
Message-ID: <1992Oct4.121217.2903@wkuvx1.bitnet>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!ukma!netnews.louisville.edu!wkuvx1!haydedr
References: <WAYNE.92Oct4013500@dew.cs.odu.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!ukma!netnews.louisville.edu!wkuvx1!haydedr
From: haydedr@wkuvx1.bitnet
Newsgroups: alt.msdos.programmer
Subject: Re: Stack Overflow in Turbo C
Message-ID: <1992Oct4.121217.2903@wkuvx1.bitnet>
Date: 4 Oct 92 12:12:17 CDT
References: <WAYNE.92Oct4013500@dew.cs.odu.edu>
Organization: Western Kentucky University, Bowling Green, KY
Lines: 30