External Linkage
William B. Tyler
tyler at decvax.UUCP
Thu Jan 18 09:03:57 AEST 1990
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
More information about the Comp.std.c
mailing list