Mail Archives: djgpp/1997/07/23/23:40:43
Kenn White wrote:
>
> I'm having trouble with the *very* simple program below.
> It seems that when the integer x is forceably set (i.e.,
> statically allocated), I get a run-time crash. When
> is is malloced, however, everything is fine.
> #define SIZE 1000000
It's this. The default stack in DJGPP programs is 256K, and does not
grow dynamically. It's no wonder you're getting a stack fault here; I'm
amazed you didn't have worse problems.
FYI, x is not being declared statically; it's being declared
automatically. If you use the static qualifier, or declare it globally,
your program will work.
For information on setting the stack size of DJGPP programs, and other
trivia, see chapter 15.9 of the FAQ (v2/faq210b.zip from SimTel or
online at http://www.delorie.com/djgpp/v2faq/).
hth!
--
---------------------------------------------------------------------
| John M. Aldrich, aka Fighteer I | mailto:fighteer AT cs DOT com |
| * Proud user of DJGPP! * | http://www.cs.com/fighteer |
| ObJoke: If Bill Gates were a robber, not only would he |
| shoot you, but he'd send you a bill for the bullets. |
---------------------------------------------------------------------
- Raw text -