I’m pretty sure it’s defined, and x should have the value 1. §3.6.2/1 says: “Objects with static storage duration (3.7.1) shall be zero-initialized (8.5) before any other initialization takes place.”
After that, I think it’s all pretty straightforward.
More Related Contents:
- Is there a difference between copy initialization and direct initialization?
- What do the following phrases mean in C++: zero-, default- and value-initialization?
- C++ static initialization order
- What are the differences between C-like, constructor, and uniform initialization?
- Does the default constructor initialize built-in types?
- Initialize static variables in C++ class?
- Variable initialization in C++
- Why can’t simple initialize (with braces) 2D std::array? [duplicate]
- What are the advantages of list initialization (using curly braces)?
- C++ Static member initialization (template fun inside)
- Why class data members can’t be initialized by direct initialization syntax?
- How to initialize std::array elegantly if T is not default constructible?
- What happens to uninitialized variables? C++
- Is reading an indeterminate value undefined behavior?
- C++11 member initializer list vs in-class initializer?
- Easy way find uninitialized member variables
- How is static variable initialization implemented by the compiler?
- C++ Structure Initialization [duplicate]
- Has the new C++11 member initialization feature at declaration made initialization lists obsolete?
- static member initialization for specialized template class
- Is it safe to use the “this” pointer in an initialization list?
- How to create std::array with initialization list without providing size directly [duplicate]
- Is there a way to make a C++ struct value-initialize all POD member variables?
- What’s the difference between Radio r = Radio(“PSR”, 100.8) and Radio(“PSR”, 100.8)?
- Initialization difference with or without curly braces in C++
- Initializing an std::array of non-default-constructible elements?
- Is uninitialized data behavior well specified?
- C++ function called without object initialization
- C++ – value of uninitialized vector
- C++ default initialization and value initialization: which is which, which is called when and how to reliably initialize a template-type member