m4-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sysval and doc fixes


From: Ralf Wildenhues
Subject: Re: sysval and doc fixes
Date: Thu, 22 Jun 2006 10:57:00 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]