> File size can be less than memory size when you have data reserved but not 
> initialized. That happens in many cases, e.g. when you reserve a buffer.

>> One benefit to declaring data in the bss section is that the data is not
>> included in the executable program. When data is defined in the data
>> section, it must be included in the executable program, since it must be
>> initialized with a specific value. Because the data areas declared in the
>> bss section are not initialized with program data, the memory areas are
>> reserved at runtime, and do not have to be included in the final program.

i don't think uninitialized means what you think it does.  for the
benefit of those who might be confused by this largely purposeful
misdirection, the bss is initialized to zero.  the c standard
specifies that external declarations without explicit initialization
are initialized to zero.  this is intialized data that doesn't appear
in the executable.

because i'm pedantic, i'll point out that zero has always been a
specific value.

- erik


Reply via email to