Why can't you define an external object twice and never use it?

Paul Eggert eggert at twinsun.com
Tue Nov 14 13:11:05 AEST 1989


I asked what was wrong with the external definitions `int X = 0; int X = 0;'
if X is used nowhere else.  Doug Gwyn replied:

	I don't know why you cite constraints on multiple definition;
	the real problem is that you have violated the "only one
	initialization" constraint.

Where is this constraint written down?  It's not in either pANS 3.5.7
("Initialization") or pANS 3.7 ("External definitions"), where I would
have expected it.  I fear it was so obvious that it wasn't written
down anywhere.



More information about the Comp.std.c mailing list