question about scope & linkage

Doug Gwyn gwyn at smoke.BRL.MIL
Sat Aug 12 17:44:58 AEST 1989


In article <1002 at virtech.UUCP> cpcahil at virtech.UUCP (Conor P. Cahill) writes:
>	...In the alternate formulation, which is usual in UNIX systems and
>	recognized as a common extension by the Standard, ...

However, note that this "common extension" (so-called because that is
the title of the section of the Standard wherein it is described)
violates the requirements of the Standard.  The "common extensions"
are not in the enforceable part of the Standard, and some of us think
they have no business being printed as an apparent part of the Standard.
(We were outvoted, though; the "Common Extensions" section had political
if not technical value.)

	int i;
at file scope (assuming there is no other file-scope definition for i
in the same translation unit) does reserve storage for i, and it does
have the initial value 0.  A standard-conforming translator is obliged
to enforce this.  Since it also has external linkage, the occurrence
of
	int i = 17;
at file scope in another translation unit directly conflicts with the
0 initializer of the first translation unit.  These rules date back to
the first edition of K&R.



More information about the Comp.lang.c mailing list