eggert@twinsun.com (Paul Eggert) (03/06/91)
rfg@lupine.ncd.com (Ron Guilmette) asks whether an implementation should report an error given the two files a.c: int w; b.c: int w; It's implementation-dependent. This is covered at length in the Rationale's 3.1.2.2. Even though this usage is not strictly conforming, a conforming implementation need not report this usage as an error, because the relevant rules in 3.7 are listed under ``Semantics'', not under ``Constraints''. The traditional Unix interpretation is a common extension. Other extensions are possible. For example, a conforming implementation can also accept the following extension: d.c: int x = 0; e.c: int x = 0; Indeed, a conforming implementation resolve disputes among external definitions in separate translation units using any method it likes. For example, it can discard zero initializers in such situations, which would allow the following: f.c: int y = 0; g.c: int y = 5; and would initialize y to 5. Although I don't recommend this last extension, it is a tempting one with the traditional Unix linker, because it generates smaller executables in the more common case of h.c: int z[1000] = {0}; i.c: int z[1000];