https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112013-09-11T09:45:50ZRuby Issue Tracking SystemRuby master - Feature #8890: [PATCH] Eliminate less-than-zero checks for unsigned variableshttps://bugs.ruby-lang.org/issues/8890?journal_id=417312013-09-11T09:45:50Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Description</strong> updated (<a title="View differences" href="/journals/41731/diff?detail_id=30262">diff</a>)</li></ul><p>Currently we don't assume C99, but C89.</p> Ruby master - Feature #8890: [PATCH] Eliminate less-than-zero checks for unsigned variableshttps://bugs.ruby-lang.org/issues/8890?journal_id=417602013-09-12T04:46:44Ztonyo (Anton Ovchinnikov)revolver112@gmail.com
<ul></ul><p>OK, same for C89: <a href="http://port70.net/~nsz/c/c89/c89-draft.html" class="external">http://port70.net/~nsz/c/c89/c89-draft.html</a>, section 4.1.5.</p> Ruby master - Feature #8890: [PATCH] Eliminate less-than-zero checks for unsigned variableshttps://bugs.ruby-lang.org/issues/8890?journal_id=417612013-09-12T06:12:38Zkosaki (Motohiro KOSAKI)kosaki.motohiro@gmail.com
<ul></ul><p>It would be nice configure script abort if detect signed size_t. It protects us from crazy and invalid platform issue.<br>
Other than that, the patch looks good to me.</p> Ruby master - Feature #8890: [PATCH] Eliminate less-than-zero checks for unsigned variableshttps://bugs.ruby-lang.org/issues/8890?journal_id=417712013-09-12T22:37:13Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li><li><strong>% Done</strong> changed from <i>0</i> to <i>100</i></li></ul><p>This issue was solved with changeset r42920.<br>
Anton, thank you for reporting this issue.<br>
Your contribution to Ruby is greatly appreciated.<br>
May Ruby be with you.</p>
<hr>
<p>Eliminate less-than-zero checks for unsigned variables</p>
<ul>
<li>ext/bigdecimal/bigdecimal.c, ext/digest/md5/md5.c,<br>
ext/json/fbuffer/fbuffer.h, ext/json/generator/generator.c:<br>
Eliminate less-than-zero checks for unsigned variables.<br>
According to section 4.1.5 of C89 standard, size_t is an unsigned<br>
type. These checks were found with 'cppcheck' static analysis tool.<br>
<a href="/issues/8890">[ruby-core:57117]</a> [Feature <a class="issue tracker-2 status-5 priority-4 priority-default closed" title="Feature: [PATCH] Eliminate less-than-zero checks for unsigned variables (Closed)" href="https://bugs.ruby-lang.org/issues/8890">#8890</a>]</li>
</ul>