Python.h problem-> /usr/include/python2.2/longobject.h:48: warning: ISO C89 does not support `long long'

Skip Montanaro skip at pobox.com
Tue Feb 10 20:33:32 EST 2004


    Chris> However, I know in near future all Python integers will be of
    Chris> type "Python long" and there won't be "Python ints" anymore IIRC.

    Chris> I wonder if Python source will still use 64 bit ints then in
    Chris> implementation.

Yes, it still will.  If you peek a bit into the source, take a look at
Include/longobject.h.  You'll see:

    #ifdef HAVE_LONG_LONG
    PyAPI_FUNC(PyObject *) PyLong_FromLongLong(PY_LONG_LONG);
    PyAPI_FUNC(PyObject *) PyLong_FromUnsignedLongLong(unsigned PY_LONG_LONG);
    PyAPI_FUNC(PY_LONG_LONG) PyLong_AsLongLong(PyObject *);
    PyAPI_FUNC(unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLong(PyObject *);
    PyAPI_FUNC(unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLongMask(PyObject *);
    #endif /* HAVE_LONG_LONG */

These declarations allow long long integers to be converted to Python long
integers.  (There are other similar uses in the source code.)  Those sorts
of conversions will still be desirable even after the int->long merger is
complete.  As Tim pointed out 'long long' is in C99, so over time, this sort
of usage will become more mainstream.

Skip




More information about the Python-list mailing list