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/2012-June/120618.html below:

[Python-Dev] Checking if unsigned int less then zero.

[Python-Dev] Checking if unsigned int less then zero. [Python-Dev] Checking if unsigned int less then zero.Peter Otten __peter__ at web.de
Fri Jun 22 11:55:16 CEST 2012
Dmitriy Tochansky wrote:

> Playing with cpython source, I found some strange strings in
> socketmodule.c:
> 
> ---
>          if (flowinfo < 0 || flowinfo > 0xfffff) {
>              PyErr_SetString(
>                  PyExc_OverflowError,
>                  "getsockaddrarg: flowinfo must be 0-1048575.");
>              return 0;
>          }
> ---
> 
> ---
>      if (flowinfo < 0 || flowinfo > 0xfffff) {
>          PyErr_SetString(PyExc_OverflowError,
>                          "getsockaddrarg: flowinfo must be 0-1048575.");
>          return NULL;
>      }
> ---
> 
> The flowinfo variable declared few strings above as unsgined int. Is
> there any practical sense in this check? Seems like gcc just removes
> this check. I think any compiler will generate code that checks as
> unsigned, for example in x86 its JAE/JGE. May be this code is for "bad"
> compilers or exotic arch?

I think you are right, the < 0 check is redundant. The developers probably 
forgot to remove it when

http://bugs.python.org/issue9975

was fixed.

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