question about scope & linkage

Doug Gwyn gwyn at smoke.BRL.MIL
Fri Aug 11 06:52:05 AEST 1989


In article <57257 at tut.cis.ohio-state.edu> Christopher Lott <cml at cis.ohio-state.edu> writes:
>(what is a 'translation unit' ??)

A source file and the other files it #includes, directly or indirectly.

>... However, the linker does not complain about a multiply-defined symbol, ...

Yes, that's because your C implementation uses the "COMMON" model for external
object linkage, instead of the "DEF/REF" model described in K&R (1st Edition).
Most UNIX systems are that way.  For portability, you should fix the source so
that there is only one non-"extern" declaration of such an object among all
the translation units that produce the object modules that get linked together.



More information about the Comp.lang.c mailing list