linkage specifiers

daniel at terra.ucsc.edu daniel at terra.ucsc.edu
Thu Apr 4 08:19:55 AEST 1991


What does it mean for an extern linkage specifier
to refer to a non-file scope object?

For example:

	int foo = 2;

	int bar(int foo)
	{
		{
			extern int foo;

			return foo;
		}
	}

Paraphrased from 3.1.2.2: 
  ''If the declaration of an identifier ... contains "extern", the
	identifier has the same linkage as any visible declaration
	of the identifier with file scope.''

This sentence clearly does not apply, because the file-scope 
declaration is not visible; the parameter declaration hides it.

To what object does the extern declaration refer?
It appears to refer to the parameter declaration. 
Is this necessarily the case? Could it denote some
as-yet-unseen file-scope object having external linkage?

Daniel Edelson



More information about the Comp.std.c mailing list