🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #2516

A question about tenative definitions

#2516
From: Ron Guilmette
Date: Sun, 03 Mar 1991 17:32
32 lines
1829 bytes
I'm having a discussion with a C implementor I know about the meaning of
the following sentence from the ANSI C standard.  (I think that this came
from section 3.7.2, but I'm at home right now and I don't have the standard
with me at the moment, so I'm not sure.)

	    "If a translation unit contains one or more tenative definitions
	    for an identifier, and the translation unit contains no external
	    definition for that identifier, then the behavior is exactly as
	    if the translation unit contains a file scope declaration of that
	    identifier, with a composite type as of the end of the translation
	    unit, with an initializer equal to zero."

What exactly does this mean?  My off-the-cuff interpretation of this
statement was that if you had two files like:

	one.c:
	---------------------------------------------------------------------
	int xxyyzz;
	---------------------------------------------------------------------

	two.c:
	---------------------------------------------------------------------
	int xxyyz;
	---------------------------------------------------------------------

and if you compiled them both and then tried to link them together into
the same single program, that you should get an error at link time because
there are two conflicting external *definitions* of the variable xxyyzz.

This implementor I know disagrees with my interpretation.

Who is right? 
Technical Details
Message-ID: <4218@lupine.NCD.COM>
Path: arc1-ca.pugleaf.net!utzoo!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!decwrl!infopiz!lupine!lupine.ncd.com

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!decwrl!infopiz!lupine!lupine.ncd.com
From: rfg@lupine.ncd.com (Ron Guilmette)
Newsgroups: comp.std.c
Subject: A question about tenative definitions
Message-ID: <4218@lupine.NCD.COM>
Date: 3 Mar 91 17:32:24 GMT
Sender: news@NCD.COM
Organization: Network Computing Devices, Inc., Mt. View, CA
Lines: 32