[Python-Dev] Pep 353: Py_ssize_t advice (original) (raw)
David Abrahams dave at boost-consulting.com
Sat Sep 23 00:17:13 CEST 2006
- Previous message: [Python-Dev] Pep 353: Py_ssize_t advice
- Next message: [Python-Dev] Pep 353: Py_ssize_t advice
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"Martin v. Löwis" <martin at v.loewis.de> writes:
David Abrahams schrieb:
#if PYVERSIONHEX < 0x02050000 typedef int Pyssizet; #define PYSSIZETMAX INTMAX #define PYSSIZETMIN INTMIN #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 PYVERSIONHEX < 0x02050000 && !defined(PYSSIZETMIN) Strictly speaking, this shouldn't be necessary. C allows redefinition of an object-like macro if the replacement list is identical (for some definition of identical which applies if the fragment is copied literally from the PEP). So I assume you had non-identical replacement list?
No:
a. I didn't actually experience a collision; I only anticipated it
b. We were using C++, which IIRC does not allow such redefinition
c. anyway you'll get a nasty warning, which for some people will be just as bad as an error
Can you share what alternative definition you were using?
In any case, I still think this is good practice, so I added it to the PEP.
Thanks,
-- Dave Abrahams Boost Consulting www.boost-consulting.com
- Previous message: [Python-Dev] Pep 353: Py_ssize_t advice
- Next message: [Python-Dev] Pep 353: Py_ssize_t advice
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]