<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">Using uninitialized variable causes undefined behavior. As discussion in <a href="http://llvm.org/bugs/show_bug.cgi?id=16642">http://llvm.org/bugs/show_bug.cgi?id=16642</a> (Optimization eliminates an overflow check) demonstartes, it may be dangerous, if compiler tries to optimize. So the initialization was added for safety.</div>
<div class="gmail_quote"><br></div><div class="gmail_quote">In regular build the warning is already turned off, I just experimented with compilation out of the tree.</div><div class="gmail_quote"><br></div><div class="gmail_quote">
Thanks,</div><div class="gmail_quote">--Serge</div><div class="gmail_quote"><br></div><div class="gmail_quote">2013/7/20 Rafael Espíndola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">ah, ok.<br>
<br>
I wonder if we should disable this warning. We do it for gcc, no?<br>
<div class=""><div class="h5"><br>
On 19 July 2013 15:51, Serge Pavlov <<a href="mailto:sepavloff@gmail.com">sepavloff@gmail.com</a>> wrote:<br>
> It removes complains of Visual Studio 2012. TempFileHandle is initialized in<br>
> one branch of switch statement (case FS_File). Then below in the code<br>
> TempFileHandle is used:<br>
><br>
>   if (error_code ec = UTF16ToUTF8(random_path_utf16.begin(),<br>
>                                   random_path_utf16.size(), result_path)) {<br>
>     switch (Type) {<br>
>     case FS_File:<br>
>       ::CloseHandle(TempFileHandle);<br>
><br>
>  It is again 'case FS_File' so TempFileHandle is initialized in fact, but<br>
> VS2012 compiler fais to reveal it.<br>
><br>
><br>
> 2013/7/20 Rafael Espíndola <<a href="mailto:rafael.espindola@gmail.com">rafael.espindola@gmail.com</a>><br>
>><br>
>> > Initialize TempFileHandle.<br>
>><br>
>> Why? Which code path was using it uninitialized?<br>
>><br>
>> Cheers,<br>
>> Rafael<br>
><br>
><br>
><br>
><br>
> --<br>
> Thanks,<br>
> --Serge<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Thanks,<br>--Serge<br>
</div></div>