www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/11/21/01:44:28

From: dnelson AT quake DOT xnet DOT com (Dan Nelson)
Subject: Re: HUGE exe
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Date: Sun, 20 Nov 1994 22:24:32 -0600 (CST)

in the last episode, Aaron Ucko said:
><OKRA AT max DOT tiac DOT net> wrote:
>>  Want to see a BIG program?  Here it is:
>>  
>> char CellMap[256][512];
>> int main()
>> {  memset(CellMap,0,sizeof(CellMap));
>> }
>>   The exe it makes is about 156k.  Anybody know how to tell memset that I 
>> really want it to run at RUN TIME?  It "optimizes" itself even with 
>> optimizations off.
> 
> If you want your array to be allocated dynamically, you can't declare it as
> allocated statically.  You need code like this:

Doesn't gcc use BSS chunks?  Apperently it does, since a compile of the
above program on a Sun w/gcc gives an executable of 16k, with a 123k BSS
chunk (as reported by size).

This should not happen.  I only have a 286 on me at the moment, so I can't
veify it, but djgpp/gcc should properly put static data in the BSS chunk.

	-Dan

- Raw text -


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