Re: avr-gcc : .bss always set variables to zero ?
- From: John Temples <usenet@xxxxxxxxxxxxxx>
- Date: Sat, 23 Apr 2005 23:53:50 -0500
In article <3cv5skF6m64rsU1@xxxxxxxxxxxxxx>, Not Really Me wrote:
> Stated simply, if you need something to be zero you should specify an
> initial value or declare it static
No; "static storage duration" does not only mean "with the
storage-class specifier static." Note the "or" in section 6.2.4 you
"An object whose identifier is declared with external or internal
linkage, OR with the storage-class specifier static has static storage
According to 6.2.2, a non-static global has external linkage:
"If the declaration of an identifier for an object has file scope and
no storage-class specifier, its linkage is external."
And thus has static storage duration, and thus is initialized.
John W. Temples, III