🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #1032

Re: multiple definitions of identifiers with external linkage

#1032
From: Paul Eggert
Date: Wed, 29 Nov 1989 19:09
21 lines
1235 bytes
Doug Gwyn writes:

	My suggestion is to generate a warning (not an official diagnostic) for
	the second definition within a translation unit, and generate code for
	only the first definition.  Inter-translation unit multiple definitions
	are handled the usual way (typically by the linker).  That technique
	should be standard conforming.

Does this suggestion mean that the following strictly conforming program with
two translation units should link correctly, albeit perhaps with warnings?

	x.c:
		int F(){return 0;}
		int G(int i){return i;}
	y.c:
		int F(){return 1;}
		int G(int);
		int main() {return G(0);}

Won't most linkers flatly refuse to link this program
because F is defined twice?
Technical Details
Message-ID: <58@looney.twinsun.com>
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!ucla-cs!twinsun!eggert
References: <11193@riks.csl.sony.co.jp> <11693@smoke.BRL.MIL> <57@looney.twinsun.com> <11699@smoke.BRL.MIL>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!ucla-cs!twinsun!eggert
From: eggert@twinsun.com (Paul Eggert)
Newsgroups: comp.std.c
Subject: Re: multiple definitions of identifiers with external linkage
Message-ID: <58@looney.twinsun.com>
Date: 29 Nov 89 19:09:40 GMT
References: <11193@riks.csl.sony.co.jp> <11693@smoke.BRL.MIL> <57@looney.twinsun.com> <11699@smoke.BRL.MIL>
Sender: news@twinsun.com
Reply-To: eggert@twinsun.com (Paul Eggert)
Organization: Twin Sun, Inc
Lines: 21