<div dir="ltr">On 31 October 2013 08:31, Peter Sommerlad <span dir="ltr">&lt;<a href="mailto:peter.sommerlad@hsr.ch" target="_blank">peter.sommerlad@hsr.ch</a>&gt;</span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Chris,<br>
<br>
I teach my C++11 students to always use curly braces when defining a variable or assign an auto variable from an expression. This way it is guaranteed to be initialized. Any code that doesn&#39;t use them is easy to spot.<br>

</blockquote><div><br></div><div>In practice I&#39;ve found this helps make the bugs repeatable at run time, but rarely addresses the underlying problem.  People ought to think about how they want to initialize stuff.<br>

<br></div><div>And then there are annoying cases where that just doesn&#39;t work:<br><br></div><div>struct S<br>{<br></div><div>    S() : b{} ()  // does not do what you think it should do<br><br></div><div>    std::atomic&lt;bool&gt; b;<br>

};<br clear="all"></div></div><br></div><div class="gmail_extra">Like the pro-ub arguments, just initializing something makes it much harder to analyze the code to find bugs.<br></div><div class="gmail_extra">-- <br> Nevin &quot;:-)&quot; Liber  &lt;mailto:<a href="mailto:nevin@eviloverlord.com" target="_blank">nevin@eviloverlord.com</a>&gt;  (847) 691-1404
</div></div>