<div class="gmail_quote">On Thu, Apr 28, 2011 at 4:36 PM, Chris Lattner <span dir="ltr"><<a href="mailto:clattner@apple.com">clattner@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im"><br>
On Apr 28, 2011, at 3:57 PM, Argyrios Kyrtzidis wrote:<br>
<br>
> Author: akirtzidis<br>
> Date: Thu Apr 28 17:57:55 2011<br>
> New Revision: 130453<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=130453&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=130453&view=rev</a><br>
> Log:<br>
> Cut down unnecessary zero'ing when value-initializing arrays of C++ objects.<br>
><br>
> -C++ objects with user-declared constructor don't need zero'ing.<br>
<br>
</div>Are you sure that this is true?  Apparently the C++ standard requires that global variables (at least) are zero initialized and that constructors can take advantage of this.  This is apparently well defined:<br>
<br>
struct foo {<br>
 int x;<br>
<br>
 foo() {<br>
   ++x;<br>
 }<br>
} f;<br>
<br>
I'm pretty sure that this doesn't apply to temporaries etc, but it would be worth checking if you haven't already.<br></blockquote><div><br></div><div>I checked. Variables of static and thread storage must be zero initialized first as you describe. This is governed by [basic.start.init]p2 in the C++11 ISFD.</div>
<div><br></div><div>The initialization chapter provides no such pre-initialization for the other storage classes.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<font color="#888888"><br>
-Chris<br>
</font><div><div></div><div class="h5">_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</div></div></blockquote></div><br>