This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients Devin Jeanpierre, vstinner
Date 2013-04-29.23:45:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1367279126.87.0.0774347098139.issue17870@psf.upfronthosting.co.za>
In-reply-to
Content
The problem is to support platforms not providing a intmax_t type.

I don't know if the following C code would be a good "approximation" of the maximum integral value (signed/unsigned).


#ifdef HAVE_INTMAX_T
typedef intmax_t        Py_intmax_t;
typedef uintmax_t       Py_uintmax_t;
 
#elif defined(HAVE_LONG_LONG) && (SIZEOF_VOID_P <= SIZEOF_LONG_LONG)
typedef PY_LONG_LONG            Py_intmax_t;
typedef unsigned PY_LONG_LONG   Py_uintmax_t;

#elif SIZEOF_VOID_P <= SIZEOF_LONG
typedef long            Py_intmax_t;
typedef unsigned long   Py_uintmax_t;

#elif SIZEOF_VOID_P <= SIZEOF_INT
typedef int             Py_intmax_t;
typedef unsigned int    Py_uintmax_t;

#else
#   error "Python needs a typedef for Py_intmax_t in pyport.h."
#endif /* HAVE_INTMAX_T */


If it is not, conversion from/to other types like off_t, time_t, pid_t or uid_t would loose information.

It is the same question than yours: is there a platform with an integer type wider than a pointer (intptr_t/void*)?
History
Date User Action Args
2013-04-29 23:45:26vstinnersetrecipients: + vstinner, Devin Jeanpierre
2013-04-29 23:45:26vstinnersetmessageid: <1367279126.87.0.0774347098139.issue17870@psf.upfronthosting.co.za>
2013-04-29 23:45:26vstinnerlinkissue17870 messages
2013-04-29 23:45:26vstinnercreate