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 8 1727
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
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
_______________ _______________ _________
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
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)phy sics(dot)mcmast er(dot)ca
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
_______________ _______________ _________
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(PyOb ject *) PyLong_FromLong Long(PY_LONG_LO NG);
PyAPI_FUNC(PyOb ject *) PyLong_FromUnsi gnedLongLong(un signed PY_LONG_LONG);
PyAPI_FUNC(PY_L ONG_LONG) PyLong_AsLongLo ng(PyObject *);
PyAPI_FUNC(unsi gned PY_LONG_LONG) PyLong_AsUnsign edLongLong(PyOb ject *);
PyAPI_FUNC(unsi gned PY_LONG_LONG) PyLong_AsUnsign edLongLongMask( 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
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 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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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. What happens is that
Python 2.4 replaces the /usr/bin/python module with the Python 2.4
version. If I replace /usr/bin/python with the Python 2.3 version
executable, which is still on my system, that all the aforesaid modules
depend on, they start...
|
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 the debug version built by me, both downloaded today to
have the latest version).
|
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 pragmatic
- 3) I usually move forward when I get the gut feeling I am correct
- 4) Most likely because of 1), I usually do not manage to fully explain 3)
when it comes true.
- 5) I have developed for many years (>18) in many different environments,...
|
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 want to obtain is not possible, but I would
like the advice of more experienced python programmers.
I am writing a relatively complex program in python that has now around
40 files.
|
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]}
| |
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
|
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 footprint which says:
"Indeed, one often hears arguments against building exibility into an
engineered sys-
tem. For example, in the philosophy of the computer language Python it
is claimed:
\There should be one|and preferably only one|obvious...
|
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)
return s
def descrambleLine(line):
|
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
inefficient.
My prototype in Python 2.5 using NumPy required 0.41 seconds to
construct the tree from 50,000 samples. Unfortunately, searching it
felt a bit slow, finding the 11 nearest-neighbours of 1,000 points
took 29.6 seconds (and there were...
|
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 example, if I had:
-------
1 2 3
4 5 6
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |