www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/04/04/22:41:02

Xref: news2.mv.net comp.os.msdos.djgpp:2436
From: Denis Bernard <dbernard AT teleglobe DOT ca>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: GCC v2
Date: Thu, 04 Apr 1996 09:24:41 -0500
Organization: Teleglobe Canada Inc.
Lines: 24
Message-ID: <3163DBA9.3DD7@teleglobe.ca>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 960402143747 DOT 15070B AT is>
NNTP-Posting-Host: bnet-gw.teleglobe.ca
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019