On 29 Jun 2000, Ulrich Drepper wrote:
> > While most good programmers have a habit of explicitly initializing
> > variables whose initialization matters, just to make things clearer...
> 
> Nobody who knows how compilers and the linking process functions does
> this unnecessarily.  Initializing a variable puts it into the .data
> section while uninitialized variable get stored into .bss.

Only in sloppy C implementations.  Initializing a variable *to zero* does
not put it into .data if the implementation is being sensible.  Only
variables initialized to non-zero values need to be in the .data section.

> ...difference is that variables in .data sections take space in the
> binary and have to be eplicitly loaded while the room for the
> variables in .bss sections is just created.

Correct.

> Not initializing therefore descreases load time...

The difference is utterly insignificant unless the variables are large
structs or arrays.

> and increases the amount of VM which can be shared between processes.

No, it doesn't make the slightest difference to this.  Neither type of
data section can be shared.  The only difference is that .data must be
initialized from a disk copy, while .bss can be initialized by a CPU loop. 

                                                          Henry Spencer
                                                       [EMAIL PROTECTED]

-
Linux-UTF8:   i18n of Linux on all levels
Archive:      http://mail.nl.linux.org/lists/

Reply via email to