A RetroSearch Logo

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

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-August/068487.html below:

[Python-Dev] gcc 4.2 exposes signed integer overflows

[Python-Dev] gcc 4.2 exposes signed integer overflows [Python-Dev] gcc 4.2 exposes signed integer overflowsTim Peters tim.peters at gmail.com
Sun Aug 27 02:37:46 CEST 2006
[David Hopwood]
>> CPython should be fixed anyway. The correct fix is
>> "if (y == -1 && x < 0 && (unsigned long)x == -(unsigned long)x)".

Note that this was already suggested in the bug report.

[Thomas Wouters]
> Why not just "... && x == LONG_MIN"?

In full,

    if (y == -1 && x == LONG_MIN)

"should work" too.  In practice we try to avoid numeric symbols from
platform header files because so many platforms have screwed these up
over the centuries (search for LONG_BIT or HUGE_VAL ;-)), and because
it's better (when possible) not to tie the code to that `x` was
specifically declared as type "long" (e.g., just more stuff that will
break if Python decides to make its short int of type PY_LONG_LONG
instead).  In this specific case, there may also have been a desire to
avoid generating a memory load for a fat constant.  However, since
this is integer division, in real life (outside the test suite) we'll
never go beyond the "y == -1" test.
More information about the Python-Dev mailing list

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