On Dec 17, 2009, at 9:41 AM, Douglas Gregor wrote:
>> Value-initialized != unconstructed. Value-initialized is the formal name
>> for what is done to objects without user-defined default constructor
>> initialized with '()' in new-expressions and initializer lists, as well as
>> objects in an array with initializer of insufficient size. It's also what
>> will happen to objects initialized with the uniform initializer '{}' in
>> C++0x.
> 
> Right. You don't get value-initialization (with the zero-fill) for something 
> like
> 
>  void f() {
>    X x;
>  }
> 
> but you would get it for something like:
> 
>  struct Y {
>    X x;
>    Y() : x() { }
>  };
> 
> The motivation for the change to zero-initialize first then call the default 
> constructor is that a value-initialized object should be identical to a 
> global variable of the same type, as noted here:

Ok, that's still unfortunate, but we'll see if it actually matters in practice.

-Chris
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to