www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/07/16/16:13:40

Message-Id: <200007162005.QAA17661@websmtp1.bellsouth.bigfoot.com>
To: "Michel Chassey" <michelc AT primus DOT ca>, djgpp AT delorie DOT com
Subject: Re:Globals and binary size
From: "Lets Go Canes!" <LetsGoCanes AT webmail DOT bellsouth DOT net>
Date: Sun, 16 Jul 2000 16:12:42 -0400
X-Originating-IP: 209.214.161.62
Reply-To: djgpp AT delorie DOT com

Hi.

At Sat, 15 Jul 2000 18:06:38 -0500, you 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.

If the array is not initialized as part of its
declaration, most systems don't actually put the entire
array in the executable.  Instead, it puts information
that tells the OS that the program needs an array of
size "n".  So regardless of the size of the array, you
only get the 49-53 bytes that contain the information
on the array.

Depending on the OS, you may see the same type of behavior if the array is initialized to all zero, or maybe even all the same value (i.e., all "9"s or
something).


---------------
Let's Go Canes!

- Raw text -


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