Mail Archives: djgpp/1996/04/04/22:41:02
Eli Zaretskii wrote:
>
> On Tue, 2 Apr 1996, Anthony Eguerre wrote:
>
> > An Other:
> > main()
> > {int t[800][800];
> > int i,j;
> > for(j=0;j!=800;j++)
> > for(i=0;i!=800;i++)
> > t[j][i]=rand();
> > }
> > result: Stack Fault...
> > The GCC v2 dont like to big variables.
>
> Please read the DJGPP FAQ list (v2/faq200b.zip from the same place you
> got DJGPP). It explains in section 15.8 that DJGPP programs by default
> have a 256KByte-long stack. Your program defines a variable that takes
> 800x800x4 = 2.56MBytes of stack, i.e. 10 times that much. To use such
> large automatic variables, you should change the default stack size as
> explained in the FAQ. A simpler solution would be to declare t[][]
> outside `main', which will make it static.
Or better yet, try malloc() :)
- Raw text -