Russell Shaw <rjshawN_o@s_pam.netspace.net.au> writes:
> Hi,
> In gcc-4.7 C99, this gets accepted in a block scope:
>
> static int a = 1;
>
> ISO/IEC 9899:201x 6.7.8p5 says:
>
> If the declaration of an identifier has block scope, and the
> identifier has external or internal linkage, the declaration shall
> have no initializer for the identifier.
I think 6.2.2 p6 is the key thing here:
"The following identifiers have no linkage: an identifier declared to
be anything other than an object or a function; an identifier declared
to be a function parameter; a block scope identifier for an object
declared without the storage-class specifier extern."
In your example, 'a' has no linkage. For block scope declarations,
static alters only the lifetime of the object, not the linkage of the
identifier.
--
Ben.
|