Path: utzoo!dptcdc!jarvis.csri.toronto.edu!mailrus!ames!ucsd!sdcsvax!ucsdhub!sdsu!lindwall From: lindwall@sdsu.UUCP (John Lindwall) Newsgroups: comp.sys.amiga.tech Subject: Re: Aztec-C and stack size Summary: Too much automatic storage? Message-ID: <3713@sdsu.UUCP> Date: 18 Apr 89 06:32:31 GMT References: <1119@jato.Jpl.Nasa.Gov> Organization: San Diego State University, Math/Sciences Dept. Lines: 43 In article <1119@jato.Jpl.Nasa.Gov>, zupke@jato.Jpl.Nasa.Gov (Brian Zupke ) writes: > > Howdy! > > Does anyone know if programs written with Manx Aztec-C require a minimum > stack size of 8000 bytes? Well, it seems to be the case with a program > that I'm working on. It works fine when the stack is set to at least 8000, > but will crash when it's set to 4000. Any ideas? > > Thanks! > > --Brian I'll probably not be the only offering this suggestion but just in case -- Take a look at the number and/or size of any automatic (local) variables you are declaring in your various functions. Automatic variables are allocated on the stack, so if you claim too much stack space for them you may cause overflow. As a test of this problem you can compile with the +m switch which enables stack-checking code to be performed as part of the function startup sequence. The default action on stack-overflow is to print a message and exit, but by defining a function __stkover() to overide the library version you can do your own graceful exit. An example of a 'bad' function might be int foo () { int ImRealBig[10000]; /* Bye-Bye Stack! */ ... } The description of the +m option is from the manual, but I have not tested it personally. Let us know if this is the problem and if the +m option performs as advertised! ------------------------------------------------------------------------------- The above opinions are mine, not my employer's nor my school's John Lindwall johnl@tw-rnd.SanDiego.NCR.COM