473,509 Members | 3,543 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

c extension compilation gives this gripe about python itself with
-Wall and -pedantic switches -->
/usr/include/python2.2/longobject.h:48: warning: ISO C89 does not
support `long long'

Is there any way to avoid this?

Chris
Jul 18 '05 #1
8 1722

Chris> c extension compilation gives this gripe about python itself with
Chris> -Wall and -pedantic switches -->
Chris> /usr/include/python2.2/longobject.h:48: warning: ISO C89 does not
Chris> support `long long'

Chris> Is there any way to avoid this?

Sure. Get rid of the -pedantic switch...

Skip

Jul 18 '05 #2
Skip

Thanks for the help.
I agree. Perhaps I'm being "pedantic" :) but I was just
curious if Python source is using stuff that is NOT ANSI C.

Is "long long" an extension of ANSI C? That Python uses?

Chris

On Tue, Feb 10, 2004 at 05:02:10PM -0600, Skip Montanaro wrote:

Chris> c extension compilation gives this gripe about python itself with
Chris> -Wall and -pedantic switches -->
Chris> /usr/include/python2.2/longobject.h:48: warning: ISO C89 does not
Chris> support `long long'

Chris> Is there any way to avoid this?

Sure. Get rid of the -pedantic switch...

Skip


--
_______________________________________

Christian Seberino, Ph.D.
SPAWAR Systems Center San Diego
Code 2872
49258 Mills Street, Room 158
San Diego, CA 92152-5385
U.S.A.

Phone: (619) 553-9973
Fax : (619) 553-6521
Email: se******@spawar.navy.mil
_______________________________________

Jul 18 '05 #3

Chris> Is "long long" an extension of ANSI C? That Python uses?

Yup. Python's build process knows the difference between 'long long' (the
way GCC spells it) and _int64 (the way MSVC spells it). No other extensions
are currently supported. Are there other ways to spell "64-bit int" in use
at the moment?

Skip

Jul 18 '05 #4
At some point, Skip Montanaro <sk**@pobox.com> wrote:
Chris> Is "long long" an extension of ANSI C? That Python uses?

Yup. Python's build process knows the difference between 'long long' (the
way GCC spells it) and _int64 (the way MSVC spells it). No other extensions
are currently supported. Are there other ways to spell "64-bit int" in use
at the moment?


Well, in C99 it's int64_t (which is guaranteed to be a 64-bit signed
integer). Or int_least64_t (at least 64 bits) or int_fast64_t (native
type with at least 64 bits that's the fastest of the alternatives).

Mind you, with GCC they're all typedef'ed to long long int (or long
int for 64-bit platforms).

Hmm, does PY_LONG_LONG have to be (at least) 64-bits? A quick grep
through the source seems to suggest that it's used as a large integer
type -- not as something that holds at least 64 bits.

--
|>|\/|<
/--------------------------------------------------------------------------\
|David M. Cooke
|cookedm(at)physics(dot)mcmaster(dot)ca
Jul 18 '05 #5
Skip

Thanks, that explains a lot.

Extensions to ANSI C don't cause any problems
per se that I can think of.

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

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

chris

On Tue, Feb 10, 2004 at 06:50:26PM -0600, Skip Montanaro wrote:

Chris> Is "long long" an extension of ANSI C? That Python uses?

Yup. Python's build process knows the difference between 'long long' (the
way GCC spells it) and _int64 (the way MSVC spells it). No other extensions
are currently supported. Are there other ways to spell "64-bit int" in use
at the moment?

Skip


--
_______________________________________

Christian Seberino, Ph.D.
SPAWAR Systems Center San Diego
Code 2872
49258 Mills Street, Room 158
San Diego, CA 92152-5385
U.S.A.

Phone: (619) 553-9973
Fax : (619) 553-6521
Email: se******@spawar.navy.mil
_______________________________________

Jul 18 '05 #6

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

Jul 18 '05 #7
David M. Cooke wrote:
Hmm, does PY_LONG_LONG have to be (at least) 64-bits? A quick grep
through the source seems to suggest that it's used as a large integer
type -- not as something that holds at least 64 bits.


No. Instead, PY_LONG_LONG should be intmax_t. In particular, it should
be large enough to hold a file size, and a time_t.

Regards,
Martin

Jul 18 '05 #8
se******@spawar.navy.mil wrote:
However, I know in near future all Python
integers will be of type "Python long" and there
won't be "Python ints" anymore IIRC.
You might remember incorrectly, atleast with respect
to the time scale in which this is happening.
I wonder if Python source will still use 64 bit ints then in
implementation.


C ints and long longs have nothing to do with Python
ints and longs. A Python int is implemented with a C long,
and a Python long is not implemented with any primitive type
(instead, it is implemented as an array of C shorts).

In any case, Python will continue to use the PY_LONG_LONG
type even if Python ints would go away.

Regards,
Martin

Jul 18 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
3196
by: Edward Diener | last post by:
I can install Python 2.4 on the Fedora 3 Linux system, but after I do a number of Linux utilities and commands, like yum, stop working because they were dependent on the Python 2.3 installation....
2
2748
by: Ugo Di Girolamo | last post by:
I have the following code, that seems to make sense to me. However, it crashes about 1/3 of the times. My platform is Python 2.4.1 on WXP (I tried the release version from the msi and...
137
6929
by: Philippe C. Martin | last post by:
I apologize in advance for launching this post but I might get enlightment somehow (PS: I am _very_ agnostic ;-). - 1) I do not consider my intelligence/education above average - 2) I am very...
10
9893
by: TokiDoki | last post by:
Hello there, I have been programming python for a little while, now. But as I am beginning to do more complex stuff, I am running into small organization problems. It is possible that what I...
99
4575
by: Shi Mu | last post by:
Got confused by the following code: >>> a >>> b >>> c {1: , ], 2: ]} >>> c.append(b.sort()) >>> c {1: , ], 2: , None]}
13
6467
by: 7stud | last post by:
test1.py: -------------------- import shelve s = shelve.open("/Users/me/2testing/dir1/aaa.txt") s = "red" s.close() --------output:------ $ python test1.py
206
8170
by: WaterWalk | last post by:
I've just read an article "Building Robust System" by Gerald Jay Sussman. The article is here: http://swiss.csail.mit.edu/classes/symbolic/spring07/readings/robust-systems.pdf In it there is a...
23
2496
by: Python Maniac | last post by:
I am new to Python however I would like some feedback from those who know more about Python than I do at this time. def scrambleLine(line): s = '' for c in line: s += chr(ord(c) | 0x80)...
55
2885
by: sturlamolden | last post by:
I have recently been playing with a kd-tree for solving the "post office problem" in a 12-dimensional space. This is pure cpu bound number crunching, a task for which I suspected Python to be...
30
2675
by: Ivan Reborin | last post by:
Hello everyone, I was wondering if anyone here has a moment of time to help me with 2 things that have been bugging me. 1. Multi dimensional arrays - how do you load them in python For...
0
7237
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7137
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7347
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7416
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5656
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5062
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4732
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3218
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
779
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.