This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: static declaration follows non-static one


Andrew Makhorin <mao@gnu.org> writes:

> However, the Standard says:
>
> 	If the declaration of an identifier for an object or a function 
> 	contains the storage-class specifier extern, the identifier has 
> 	the same linkage as any visible declaration of the identifier 
> 	with file scope.
>
> Is it a gcc bug or I misunderstand something?

That paragraph does not apply because the later static
declaration is not visible at the earlier extern declaration.
Although both declarations have file scope, their scopes do not
begin at the same point, and no declaration is visible outside
its scope.

That wording in ISO/IEC 9899:1990 subclause 6.1.2.2 was also
changed in TC1, see: http://www.lysator.liu.se/c/tc1.html
And C99+TC1 subclause 6.2.2 is a bit different again.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]