<div dir="ltr">On 31 October 2013 08:31, Peter Sommerlad <span dir="ltr"><<a href="mailto:peter.sommerlad@hsr.ch" target="_blank">peter.sommerlad@hsr.ch</a>></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't use them is easy to spot.<br>
</blockquote><div><br></div><div>In practice I'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'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<bool> 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 ":-)" Liber <mailto:<a href="mailto:nevin@eviloverlord.com" target="_blank">nevin@eviloverlord.com</a>> (847) 691-1404
</div></div>