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-September/068944.html below:

[Python-Dev] Pep 353: Py_ssize_t advice

[Python-Dev] Pep 353: Py_ssize_t advice [Python-Dev] Pep 353: Py_ssize_t adviceDavid Abrahams dave at boost-consulting.com
Fri Sep 22 20:45:17 CEST 2006
Pep 353 advises the use of this incantation:

  #if PY_VERSION_HEX < 0x02050000
  typedef int Py_ssize_t;
  #define PY_SSIZE_T_MAX INT_MAX
  #define PY_SSIZE_T_MIN INT_MIN
  #endif

I just wanted to point out that this advice could lead to library
header collisions when multiple 3rd parties decide to follow it.  I
suggest it be changed to something like:

  #if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN)
  typedef int Py_ssize_t;
  #define PY_SSIZE_T_MAX INT_MAX
  #define PY_SSIZE_T_MIN INT_MIN
  #endif

(C++ allows restating of typedefs; if C allows it, that should be
something like):

  #if PY_VERSION_HEX < 0x02050000
  typedef int Py_ssize_t;
  # if !defined(PY_SSIZE_T_MIN)
  #  define PY_SSIZE_T_MAX INT_MAX
  #  define PY_SSIZE_T_MIN INT_MIN
  # endif
  #endif

You may say that library developers should know better, but I just had
an argument with a very bright guy who didn't get it at first.

Thanks, and HTH.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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