A question about tenative definitions
Ron Guilmette
rfg at lupine.ncd.com
Mon Mar 4 03:32:24 AEST 1991
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?
More information about the Comp.std.c
mailing list