[Python-Dev] ssize_t branch merged

"Martin v. Löwis" martin at v.loewis.de
Sun Feb 19 06:46:40 CET 2006

Travis E. Oliphant wrote:
> Why not just
> #if SIZEOF_SIZE_T == 2
> #define PY_SSIZE_T_MAX 0x7fff
> #elif SIZEOF_SIZE_T == 4
> #define PY_SSIZE_T_MAX 0x7fffffff
> #elif SIZEOF_SIZE_T == 8
> #define PY_SSIZE_T_MAX 0x7fffffffffffffff
> #elif SIZEOF_SIZE_T == 16
> #define PY_SSIZE_T_MAX 0x7fffffffffffffffffffffffffffffff
> #endif

That would not work: 0x7fffffffffffffff is not a valid
integer literal. 0x7fffffffffffffffL might work,
or 0x7fffffffffffffffLL, or 0x7fffffffffffffffi64.
Which of these is correct depends on the compiler.

How to spell 128-bit integral constants, I don't know;
it appears that MS foresees a i128 suffix for them.


More information about the Python-Dev mailing list