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/2001-March/013368.html below:

[Python-Dev] a small C style question

[Python-Dev] a small C style question [Python-Dev] a small C style questionFredrik Lundh fredrik@effbot.org
Fri, 2 Mar 2001 09:35:59 +0100
DEC's OpenVMS compiler are a bit pickier than most other compilers.
among other things, it correctly notices that the "code" variable in
this statement is an unsigned variable:

    UNICODEDATA:

        if (code < 0 || code >= 65536)
    ........^
    %CC-I-QUESTCOMPARE, In this statement, the unsigned 
    expression "code" is being compared with a relational
    operator to a constant whose value is not greater than
    zero.  This might not be what you intended.
    at line number 285 in file UNICODEDATA.C

the easiest solution would of course be to remove the "code < 0"
part, but code is a Py_UCS4 variable.  what if someone some day
changes Py_UCS4 to a 64-bit signed integer, for example?

what's the preferred style?

1) leave it as is, and let OpenVMS folks live with the
compiler complaint

2) get rid of "code < 0" and hope that nobody messes
up the Py_UCS4 declaration

3) cast "code" to a known unsigned type, e.g:

        if ((unsigned int) code >= 65536)

Cheers /F




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