delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2003/12/19/00:31:51

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
Message-ID: <3FE284EF.7D5E4054@yahoo.com>
From: CBFalconer <cbfalconer AT yahoo DOT com>
Organization: Ched Research
X-Mailer: Mozilla 4.75 [en] (Win98; U)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Re: allocate memory
References: <brpjb5$2nq$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE> <20031218074852 DOT 21755 DOT 00000680 AT mb-m26 DOT aol DOT com> <3FE213CB DOT 6050903 AT phekda DOT gotadsl DOT co DOT uk>
Lines: 23
Date: Fri, 19 Dec 2003 05:27:12 GMT
NNTP-Posting-Host: 12.76.138.120
X-Complaints-To: abuse AT worldnet DOT att DOT net
X-Trace: bgtnsc04-news.ops.worldnet.att.net 1071811632 12.76.138.120 (Fri, 19 Dec 2003 05:27:12 GMT)
NNTP-Posting-Date: Fri, 19 Dec 2003 05:27:12 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Richard Dawe wrote:
> Sterten wrote:
> [snip]
> > int array[big];
> > ...
> > for(i=0;i<=big;i++)array[i]=0;
> >
> > and it's down to 80K from 4M  !
> 
> Why not zero it using memset?
> 
>      memset(array, 0, sizeof(array));

If it really is big it doesn't belong in automatic storage, so put
it in static storage and ignore the initialization.  It is
automatically done for you in C.

-- 
Chuck F (cbfalconer AT yahoo DOT com) (cbfalconer AT worldnet DOT att DOT net)
   Available for consulting/temporary embedded and systems.
   <http://cbfalconer.home.att.net>  USE worldnet address!


- Raw text -


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