Affected subclause: [basic.def]
Change: C++ does not have “tentative definitions” as in C
.
E.g., at file scope,
int i;
int i;
is valid in C, invalid in C++
. This makes it impossible to define
mutually referential file-local objects with static storage duration,
if initializers are restricted to the syntactic forms of C
. For example,
struct X { int i; struct X* next; };
static struct X a;
static struct X b = { 0, &a };
static struct X a = { 1, &b };
Rationale: This avoids having different initialization rules for
fundamental types and user-defined types
. Effect on original feature: Deletion of semantically well-defined feature
. Difficulty of converting: Semantic transformation
. In C++, the initializer for one of a set of
mutually-referential file-local objects with static storage
duration must invoke a function
call to achieve the initialization
.