Why does the function even return a value? As Benjamin said, it is just a bunch of asserts with return 1 at the end.<div><br></div><div>I believe another way you can get rid of "statement with no effect" is to cast return value to void, like (void)_PyUnicode_CHECK(unicode).<br>
<div><br></div><div>Thank you,</div><div>Vlad<br><br><div class="gmail_quote">On Tue, Oct 4, 2011 at 4:57 AM, Benjamin Peterson <span dir="ltr"><<a href="mailto:benjamin@python.org">benjamin@python.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">2011/10/4 Victor Stinner <<a href="mailto:victor.stinner@haypocalc.com">victor.stinner@haypocalc.com</a>>:<br>
<div class="im">> Le 04/10/2011 01:34, benjamin.peterson a écrit :<br>
>><br>
>> <a href="http://hg.python.org/cpython/rev/afb60b190f1c" target="_blank">http://hg.python.org/cpython/rev/afb60b190f1c</a><br>
>> changeset: 72633:afb60b190f1c<br>
>> user: Benjamin Peterson<<a href="mailto:benjamin@python.org">benjamin@python.org</a>><br>
>> date: Mon Oct 03 19:34:12 2011 -0400<br>
>> summary:<br>
>> fix compiler warnings<br>
>><br>
>> +++ b/Objects/unicodeobject.c<br>
>> @@ -369,6 +369,12 @@<br>
>> }<br>
>> return 1;<br>
>> }<br>
>> +#else<br>
>> +static int<br>
>> +_PyUnicode_CheckConsistency(void *op)<br>
>> +{<br>
>> + return 1;<br>
>> +}<br>
>> #endif<br>
><br>
> Oh no, please don't do that. Calling _PyUnicode_CheckConsistency() is<br>
> reserved to debug builds. In release mode, we should not check string<br>
> consistency (it would slow down Python).<br>
<br>
</div>It should be optimized out.<br>
<div class="im"><br>
><br>
> Yes, there was a warning:<br>
><br>
> Objects/unicodeobject.c:539:13: warning: statement with no effect<br>
> _PyUnicode_CHECK(unicode);<br>
><br>
> I added these checks recently to ensure that strings are consistent just<br>
> before exiting (to help me to track down a bug).<br>
><br>
> The right fix is just to replace _PyUnicode_CHECK(unicode) by<br>
> assert(_PyUnicode_CHECK(unicode)).<br>
<br>
</div>But _PyUnicode_CheckConsistency is just a string of assertions. What<br>
sense does it make to check the return value?<br>
<font color="#888888"><br>
<br>
--<br>
Regards,<br>
Benjamin<br>
</font><div><div></div><div class="h5">_______________________________________________<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/riscutiavlad%40gmail.com" target="_blank">http://mail.python.org/mailman/options/python-dev/riscutiavlad%40gmail.com</a><br>
</div></div></blockquote></div><br></div></div>