From: Damian Yerrick Newsgroups: comp.os.msdos.djgpp Subject: Re: Globals and binary size Organization: Pin Eight Software http://pineight.8m.com/ Message-ID: References: X-Newsreader: Forte Agent 1.7/32.534 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 28 X-Trace: /KHlxNz//ifu4EdYneRnU3QoqgNg95rGq4rTpjfkf1aY6LCI1S2fkTVodgSqGioizKmx48+e2uLJ!tIMLRDdkB83srhTCKPuf2JmfVNenUar8b8TQERF2FJFxjitSyKfnyLtQh8OQlCpw35eQVzolAl+i!Cow= X-Complaints-To: abuse AT gte DOT net X-Abuse-Info: Please be sure to forward a copy of ALL headers X-Abuse-Info: Otherwise we will be unable to process your complaint properly NNTP-Posting-Date: Sun, 16 Jul 2000 04:07:41 GMT Distribution: world Date: Sun, 16 Jul 2000 04:07:41 GMT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com On Sat, 15 Jul 2000 18:06:38 -0500, "Michel Chassey" wrote: >I use many global arrays in my program and I am puzzled because the >binary size increase does not reflect sizeof ( _new_array). >As an example, adding : unsigned long long _BITMAP [ 64 ]; >(sizeof is 512), produces a binary size increase of only about 53 >bytes. This last number varies from 49 to 53. > >Could you point me to some reference on how globals are stored Ever heard of BSS? Many systems' binaries have three segments, called TEXT (program code), DATA (pre-initialized global and static data), and BSS (uninitialized global and static data that will be allocated and zero-filled on run). DJGPP probably has something similar. There is (was?) a bug in GCC that put C++ programs' uninitialized global data in DATA instead of BSS; however, it's zeroes, and zeroes are easily compressible (see also UPX). http://upx.tsx.org/ -- Damian Yerrick "I refuse to listen to those who refuse to listen to reason." See the whole sig: http://www.rose-hulman.edu/~yerricde/sig.html This is McAfee VirusScan. Add these two lines to your signature to prevent the spread of signature viruses. http://www.mcafee.com/