Gary V. Vaughan <gary <at> gnu.org> writes:
> Eric Blake wrote:
> > 
> >>> static int sysval = 0;
> > 
> > That's redundant.  Uninitialized static variables live in .bss and are
> > 0-initialized by the C runtime (it is only the heap and uninitialized
> > local variables that have garbage values).
> 
> That is implementation defined IMHO.

No.  This has nothing to do with ELF section, but is required by C.
C89, 3.1.2.4:
|    An object declared with external or internal linkage, or with the
| storage-class specifier static has static storage duration.  For such
| an object, storage is reserved and its stored value is initialized
| only once, prior to program startup.

and 3.5.7:
|    If an object that has static storage duration is not initialized
| explicitly, it is initialized implicitly as if every member that has
| arithmetic type were assigned 0 and every member that has pointer type
| were assigned a null pointer constant.  If an object that has
| automatic storage duration is not initialized explicitly, its value is
| indeterminate./65/

Cheers,
Ralf



_______________________________________________
M4-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/m4-patches

Reply via email to