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 _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com