🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #1087

External Linkage

#1087
From: William B. Tyler
Date: Wed, 17 Jan 1990 22:03
28 lines
1517 bytes
I've been trying to follow the rules for linkage given in
Section 3.1.2.2.  In particular, I'm interested in the case
where an identifier is first declared static, then extern.
For example:
		static int i;

		extern i;

The first applicable rule is that file scope declarations
including the keyword static create internal linkage for the
declared identifier.  The second rule is that if a file-scope
declaration contains the keyword extern, the identifier
has the same linkage as any visible declaration of the identifier.
In other words, the line 'extern i;' simply goes along with the
existing INTERNAL linkage!  Only if there is no visible file-scope
declaration, will the second example line force external 
linkage!  In other words, extern isn't always extern.

Is my reading correct?  I'd appreciate comment and explanation
from anyone who understands why this seemingly very strange
rule combination was adopted.

Thanks,

Bill Tyler

-- 
Bill Tyler				...(tolerant|hpda)!procase!tyler
Technical Details
Message-ID: <70@pascal.decvax.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!hplabs!nsc!voder!decvax!tyler

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!hplabs!nsc!voder!decvax!tyler
From: tyler@decvax.UUCP (William B. Tyler)
Newsgroups: comp.std.c
Subject: External Linkage
Summary: Do the rules really mean what they say??
Keywords: extern, static
Message-ID: <70@pascal.decvax.UUCP>
Date: 17 Jan 90 22:03:57 GMT
Reply-To: tyler@procase.UUCP (William B. Tyler)
Followup-To: comp.std.c
Organization: proCASE Corporation, Santa Clara, CA
Lines: 28