🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #2517

Re: A question about tenative definitions

#2517
From: Paul de Bra
Date: Mon, 04 Mar 1991 16:10
23 lines
1591 bytes
In article <4218@lupine.NCD.COM> rfg@lupine.ncd.com (Ron Guilmette) writes:
>I'm having a discussion with a C implementor I know about the meaning of
>the following sentence from the ANSI C standard...
>[ description of tentative definition deleted ]
>What exactly does this mean?  My off-the-cuff interpretation of this
>statement was that if you had two files like:
>... [ example deleted ]
>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.

Nope, you are wrong.
int xxyyzz; int xxyyzz; int xxyyzz;
may be repeated as often as you like, as they are "tentative" definitions.
you may have several (non-conflicting) tentative definitions of the same
variable.
A true (non-tentative) definition is one with initialization.
you may write int xxyyzz=1; only once.
if none of the (tentative) definitions has an initializer then the
variable will be initialized with 0.

Paul.
(debra@win.tue.nl, debra@research.att.com)
Technical Details
Message-ID: <1807@svin02.info.win.tue.nl>
Path: arc1-ca.pugleaf.net!utzoo!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!hp4nl!svin02!wsinfo11!debra
References: <4218@lupine.NCD.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!hp4nl!svin02!wsinfo11!debra
From: debra@wsinfo11.info.win.tue.nl (Paul de Bra)
Newsgroups: comp.std.c
Subject: Re: A question about tenative definitions
Message-ID: <1807@svin02.info.win.tue.nl>
Date: 4 Mar 91 16:10:18 GMT
References: <4218@lupine.NCD.COM>
Sender: news@svin02.info.win.tue.nl
Reply-To: debra@info.win.tue.nl
Organization: Eindhoven University of Technology, The Netherlands
Lines: 23