Henry Spencer <[EMAIL PROTECTED]> writes:
> While most good programmers have a habit of explicitly initializing
> variables whose initialization matters, just to make things clearer for
> the reader, C has *always* guaranteed initialization of static variables
> to zero.
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. The
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. Not initializing
therefore descreases load time and increases the amount of VM which
can be shared between processes.
The only exception to the rule is if you have to create an alias name
for a variable. Since one cannot create aliases for .bss variables
one has to initialize them.
--
---------------. ,-. 1325 Chesapeake Terrace
Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA
Red Hat `--' drepper at redhat.com `------------------------
-
Linux-UTF8: i18n of Linux on all levels
Archive: http://mail.nl.linux.org/lists/