diff options
author | Tim Peters <tim.peters@gmail.com> | 2001-08-29 21:37:10 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2001-08-29 21:37:10 (GMT) |
commit | 79248aa1e4a8f6510b1f0ef95dc9592d51e16d6c (patch) | |
tree | 8bdd40a12e1a9c279a7cd0741333a4a1e00c2bf6 /Include | |
parent | 1936745668f44dd121b50fef31a70efc07cc4ebf (diff) | |
download | cpython-79248aa1e4a8f6510b1f0ef95dc9592d51e16d6c.zip cpython-79248aa1e4a8f6510b1f0ef95dc9592d51e16d6c.tar.gz cpython-79248aa1e4a8f6510b1f0ef95dc9592d51e16d6c.tar.bz2 |
SF bug [#456252] Python should never stomp on [u]intptr_t.
pyport.h: typedef a new Py_intptr_t type.
DELICATE ASSUMPTION: That HAVE_UINTPTR_T implies intptr_t is
available as well as uintptr_t. If that turns out not to be
true, things must get uglier (C99 wants both, so I think it's
an assumption we're *likely* to get away with).
thread_nt.h, PyThread_start_new_thread: MS _beginthread is documented
as returning unsigned long; no idea why uintptr_t was being used.
Others: Always use Py_[u]intptr_t, never [u]intptr_t directly.
Diffstat (limited to 'Include')
-rw-r--r-- | Include/pyport.h | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/Include/pyport.h b/Include/pyport.h index 176e21e..aa9c1f7 100644 --- a/Include/pyport.h +++ b/Include/pyport.h @@ -63,16 +63,25 @@ Used in: LONG_LONG /* uintptr_t is the C9X name for an unsigned integral type such that a * legitimate void* can be cast to uintptr_t and then back to void* again - * without loss of information. + * without loss of information. Similarly for intptr_t, wrt a signed + * integral type. */ #ifdef HAVE_UINTPTR_T -typedef uintptr_t Py_uintptr_t; +typedef uintptr_t Py_uintptr_t; +typedef intptr_t Py_intptr_t; + #elif SIZEOF_VOID_P <= SIZEOF_INT -typedef unsigned int Py_uintptr_t; +typedef unsigned int Py_uintptr_t; +typedef int Py_intptr_t; + #elif SIZEOF_VOID_P <= SIZEOF_LONG -typedef unsigned long Py_uintptr_t; +typedef unsigned long Py_uintptr_t; +typedef long Py_intptr_t; + #elif defined(HAVE_LONG_LONG) && (SIZEOF_VOID_P <= SIZEOF_LONG_LONG) -typedef unsigned LONG_LONG Py_uintptr_t; +typedef unsigned LONG_LONG Py_uintptr_t; +typedef LONG_LONG Py_intptr_t; + #else # error "Python needs a typedef for Py_uintptr_t in pyport.h." #endif /* HAVE_UINTPTR_T */ |