A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/attachments/20110607/475d2f66/attachment.html below:

<br><br><div class="gmail_quote">On Mon, Jun 6, 2011 at 23:57, Georg Brandl <span dir="ltr">&lt;<a href="mailto:g.brandl@gmx.net">g.brandl@gmx.net</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div class="im">On 06/07/11 05:20, brett.cannon wrote:<br>


&gt; <a href="http://hg.python.org/cpython/rev/fc282e375703" target="_blank">http://hg.python.org/cpython/rev/fc282e375703</a><br>
&gt; changeset: Â  70695:fc282e375703<br>
&gt; user: Â  Â  Â  Â Brett Cannon &lt;<a href="mailto:brett@python.org">brett@python.org</a>&gt;<br>
&gt; date: Â  Â  Â  Â Mon Jun 06 20:20:36 2011 -0700<br>
&gt; summary:<br>
&gt; Â  Remove some extraneous parentheses and swap the comparison order to<br>
&gt; prevent accidental assignment.<br>
&gt;<br>
&gt; Silences a warning from LLVM/clang 2.9.<br>
<br>
</div>Swapping the comparison order here seems a bit inconsistent to me. There are<br>
lots of others around (e.g. &quot;len == 0&quot; in the patch context below). Why is<br>
this one so special?<br>
<br></blockquote><div><br></div><div>Old habit on how to do comparisons in C. Because C treats assignment as an expression it means comparisons can accidentally become an assignment if you accidentally leave out an = sign. By reversing this order it is simply not possible to have that silent bug and instead you would get a compiler error about trying to assign to a constant.</div>

<div><br></div><div>I&#39;ll revert that part of the change.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">


I think that another developer even got told off once for these kinds of<br>
comparisons.<br>
<br>
I hope the Clang warning is only about the parentheses.<br></blockquote><div><br></div><div>Yes, Clang only warned about the parentheses.</div><div><br></div><div>-Brett</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<br>


Georg<br>
<div class="im"><br>
&gt; files:<br>
&gt; Â  Modules/arraymodule.c | Â 2 +-<br>
&gt; Â  1 files changed, 1 insertions(+), 1 deletions(-)<br>
&gt;<br>
&gt;<br>
&gt; diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c<br>
&gt; --- a/Modules/arraymodule.c<br>
&gt; +++ b/Modules/arraymodule.c<br>
&gt; @@ -2091,7 +2091,7 @@<br>
&gt; Â  Â  Â if (len == 0) {<br>
&gt; Â  Â  Â  Â  Â return PyUnicode_FromFormat(&quot;array(&#39;%c&#39;)&quot;, (int)typecode);<br>
&gt; Â  Â  Â }<br>
&gt; - Â  Â if ((typecode == &#39;u&#39;))<br>
&gt; + Â  Â if (&#39;u&#39; == typecode)<br>
&gt; Â  Â  Â  Â  Â v = array_tounicode(a, NULL);<br>
&gt; Â  Â  Â else<br>
&gt; Â  Â  Â  Â  Â v = array_tolist(a, NULL);<br>
<br>
<br>
<br>
</div>_______________________________________________<br>
Python-Dev mailing list<br>
<a href="mailto:Python-Dev@python.org">Python-Dev@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/python-dev" target="_blank">http://mail.python.org/mailman/listinfo/python-dev</a><br>
Unsubscribe: <a href="http://mail.python.org/mailman/options/python-dev/brett%40python.org" target="_blank">http://mail.python.org/mailman/options/python-dev/brett%40python.org</a><br>
</blockquote></div><br>

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4