DaKoadMunky said:
Could someone with a copy of the standard verify this and provide the relevant
text?
I had never heard this before and flipping through TCPPPL I can't find anything
regarding this.
C++98 includes C90 as a subset unless in cases it mentions
differences/specialisations. The extern behaviour I said is an inherited
from C90 thing. Here is what the latest draft of C90 that I have says:
"3.7.2 External object definitions
Semantics
If the declaration of an identifier for an object has file scope
and an initializer, the declaration is an external definition for the
identifier.
A declaration of an identifier for an object that has file scope
without an initializer, and without a storage-class specifier or with
the storage-class specifier static , constitutes a tentative
definition. If a translation unit contains one or more tentative
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 the composite type as of the end of the translation
unit, with an initializer equal to 0.
If the declaration of an identifier for an object is a tentative
definition and has internal linkage, the declared type shall not be an
incomplete type.
Examples
int i1 = 1; /* definition, external linkage */
static int i2 = 2; /* definition, internal linkage */
extern int i3 = 3; /* definition, external linkage */
int i4; /* tentative definition, external linkage */
static int i5; /* tentative definition, internal linkage */
int i1; /* valid tentative definition, refers to previous */
int i2; /* $3.1.2.2 renders undefined, linkage disagreement */
int i3; /* valid tentative definition, refers to previous */
int i4; /* valid tentative definition, refers to previous */
int i5; /* $3.1.2.2 renders undefined, linkage disagreement */
extern int i1; /* refers to previous, whose linkage is external */
extern int i2; /* refers to previous, whose linkage is internal */
extern int i3; /* refers to previous, whose linkage is external */
extern int i4; /* refers to previous, whose linkage is external */
extern int i5; /* refers to previous, whose linkage is
internal */"
Regards,
Ioannis Vranos
http://www23.brinkster.com/noicys