473,804 Members | 4,269 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What GCC version had <stdint.h> defined?

I am trying to figure out how to get 2.4a2 to build a python
extension. GCC 2.2.95 does not have a stdint.h, but 3.2.3 does.
These two are the only gcc versions I have on my box.

Does anyone know which version of GCC introduced stdint.h (and
thereby uintptr_t and intptr_t)? I'd like to get the conditionals
right.

-Scott David Daniels
Sc***********@A cm.Org
Jul 18 '05 #1
10 3861
Scott David Daniels wrote:
Does anyone know which version of GCC introduced stdint.h (and
thereby uintptr_t and intptr_t)? I'd like to get the conditionals
right.


stdint.h is not part of GCC; it is part of libc6. You shouldn't do
#ifdefs based on version numbers, but instead, you should do checks
based on the features of the software, like autoconf does.

Regards,
Martin
Jul 18 '05 #2
Martin v. Löwis wrote:
Scott David Daniels wrote:
Does anyone know which version of GCC introduced stdint.h (and
thereby uintptr_t and intptr_t)? I'd like to get the conditionals
right.

stdint.h is not part of GCC; it is part of libc6. You shouldn't do
#ifdefs based on version numbers, but instead, you should do checks
based on the features of the software, like autoconf does.

Regards,
Martin


Well, currently pyconfig.h for 2.4 says:
...
#if _MSC_VER != 1200
#define HAVE_UINTPTR_T 1
#define HAVE_INTPTR_T 1
#endif
...

which is actually a pretty low bar to get over.

I'd like to change it to something like:
...
#if _MSC_VER > 1200
#define HAVE_UINTPTR_T 1
#define HAVE_INTPTR_T 1
#endif
...
#if GCC_VERSION >= 30100
#define HAVE_UINTPTR_T 1
#define HAVE_INTPTR_T 1
#endif
...

which is arguably better even if not good enough.
Is there a better test I can do at compile time?

-Scott David Daniels
Sc***********@A cm.Org
Jul 18 '05 #3
I glanced at configure.in and it checks for HAVE_UINTPTR_T, but not
HAVE_INTPTR_T. If you want this define where it's available, add the
proper test to configure.in and regenerate configure.

I think the block would be something like this, a straightforward
search-and-replace of the block for HAVE_UINTPTR_T:
AC_MSG_CHECKING (for intptr_t support)
have_intptr_t=n o
AC_TRY_COMPILE([], [intptr_t x; x = (intptr_t)0;], [
AC_DEFINE(HAVE_ INTPTR_T, 1, [Define this if you have the type
intptr_t.])
have_intptr_t=y es
])
AC_MSG_RESULT($ have_intptr_t)
if test "$have_intptr_t " = yes ; then
AC_CHECK_SIZEOF (intptr_t, 4)
fi
on the other hand, maybe this test is broken, because my system (Fedora
Core 2) configured with #undef HAVE_UINTPTR_T.

Maybe this article shows the way:
http://sources.redhat.com/ml/gdb-pat.../msg00687.html

AC_MSG_CHECKING (for uintptr_t in C library)
AC_CACHE_VAL(gd b_cv_have_uintp tr_t,
[AC_TRY_COMPILE([#include <stdint.h>],
[uintptr_t foo = 0;
return foo;],
gdb_cv_have_uin tptr_t=yes,
gdb_cv_have_uin tptr_t=no)])
AC_MSG_RESULT($ gdb_cv_have_uin tptr_t)
if test $gdb_cv_have_ui ntptr_t = yes; then
AC_DEFINE(HAVE_ UINTPTR_T)
fi
... with appropriate renaming for Python.

I'm not sure why uintptr_t or intptr_t are all that useful, since the
spellings "unsigned *" and "int *" are going to work everywhere anyway.

Jeff

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)

iD8DBQFBLpviJd0 1MZaTXX0RAhrDAJ 9O9ss+lXpcDRn5Q/r4ftGHPzDRCACgi fvK
z5TGV6FUIFnmmtp p7tA2pg0=
=4FLF
-----END PGP SIGNATURE-----

Jul 18 '05 #4
[Jeff Epler]
....
I'm not sure why uintptr_t or intptr_t are all that useful, since the
spellings "unsigned *" and "int *" are going to work everywhere
anyway.


intptr_t isn't a pointer type, it's a signed integer type wide enough
so that, for every valid void* P,

(void*)(intptr_ t)P == P

C99 refuses to guarantee that such a type exists, but Python requires
one (and int, long or "long long" is big enough on all Python
platforms to date).

Similarly for uintptr_t.
Jul 18 '05 #5
Jeff Epler wrote:
I glanced at configure.in and it checks for HAVE_UINTPTR_T, but not
HAVE_INTPTR_T. If you want this define where it's available, add the
proper test to configure.in and regenerate configure.


The problem is, of course (Billy G is always a problem), that I am running
on Win2K, so I don't run configure.in. I have two copies of MinGW --
one 2.95 (no stdint.h), and one 3.2.3 which does do stdint.h.
These were not set up when whoever built windows 2.3.4 did so -- he or
she did not know what was going to be on my disk after I downloaded and
installed python.

So, for me and my ilk ("isn't 'ilk' a lovely word" -- Albee), pyconfig.h
is a constant, not a calculated value.
-Scott David Daniels
Sc***********@A cm.Org
Jul 18 '05 #6
Scott David Daniels wrote:
I'd like to change it to something like:
...
#if _MSC_VER > 1200
#define HAVE_UINTPTR_T 1
#define HAVE_INTPTR_T 1
#endif
...
#if GCC_VERSION >= 30100
#define HAVE_UINTPTR_T 1
#define HAVE_INTPTR_T 1
#endif
...

which is arguably better even if not good enough.
That won't help at all. PC/pyconfig.h is used only
on Windows, not on Linux. On Linux, configure is run
to detect presence of things.
Is there a better test I can do at compile time?


Depends on what you want to test for. If it is
presence of stdint.h, you should test for
HAVE_STDINT_H.

Regards,
Martin
Jul 18 '05 #7
Scott David Daniels wrote:
The problem is, of course (Billy G is always a problem), that I am running
on Win2K, so I don't run configure.in. I have two copies of MinGW --
one 2.95 (no stdint.h), and one 3.2.3 which does do stdint.h.
These were not set up when whoever built windows 2.3.4 did so -- he or
she did not know what was going to be on my disk after I downloaded and
installed python.


Can you please explain what the problem is that you are trying to solve?
Apparently, it is not compiling Python.

If you are trying to compile a Python extension, can't you just check
for presence of /usr/include/stdint.h in setup.py?

But then, if you are compiling an extension - why do you even *need*
to know whether stdint.h is present?

Regards,
Martin
Jul 18 '05 #8
On Thu, 26 Aug 2004, Scott David Daniels wrote:
The problem is, of course (Billy G is always a problem), that I am running
on Win2K, so I don't run configure.in. I have two copies of MinGW --
one 2.95 (no stdint.h), and one 3.2.3 which does do stdint.h.
These were not set up when whoever built windows 2.3.4 did so -- he or
she did not know what was going to be on my disk after I downloaded and
installed python.


In this context, stdint.h is not a part of gcc per se, but rather a
part of the MinGW development environment - in the same way that a lot of
other header files in MinGW's include directory are not part of the
standard gcc distribution.

If the module code in question can be built on Unixish platforms, ISTM
you should protect your special MinGW'isms with an #ifdef WIN32, to avoid
problems with Python installations built with configure.

The question that I think you are trying to ask is "which version of MinGW
introduced stdint.h", and then see if there's a define you can use...
(I don't know of one, but then I've only used MinGW 1.1 which contains gcc
2.95).

--
Andrew I MacIntyre "These thoughts are mine alone..."
E-mail: an*****@bullsey e.apana.org.au (pref) | Snail: PO Box 370
an*****@pcug.or g.au (alt) | Belconnen ACT 2616
Web: http://www.andymac.org/ | Australia
Jul 18 '05 #9
Martin v. Löwis wrote:
Scott David Daniels wrote:
I'd like to change it <pyconfig.h> to something like:
...
#if _MSC_VER > 1200
#define HAVE_UINTPTR_T 1
#define HAVE_INTPTR_T 1
#endif
...
#if GCC_VERSION >= 30100
#define HAVE_UINTPTR_T 1
#define HAVE_INTPTR_T 1
#endif
...
which is arguably better even if not good enough.
That won't help at all. PC/pyconfig.h is used only
on Windows, not on Linux. On Linux, configure is run
to detect presence of things.


Ah -- but my problem (which I was remiss in not describing well
enough) is just that I cannot compile _at_ _all_ on the Windows
box with minGW. I don't give a whit about <stdint.h> except to
try to make sure the proper definition happens. I'd like the
following extension to compile for 2.4 (it won't now) with MinGW:

#include <Python.h>

static PyMethodDef xyzMethods[] = {
{NULL, NULL, 0, NULL} /* Sentinel */
};

#if defined(PyMODIN IT_FUNC)
PyMODINIT_FUNC
#else
void
#endif
initxyz(void)
{
PyObject *module = Py_InitModule(" xyz", xyzMethods);
PyModule_AddStr ingConstant(mod ule, "test", "value");
}

The error is roughly:
In file included from C:/python24/include/Python.h:55,
from xyzmodule.c:1:
C:/python24/include/pyport.h:69: parse error before "Py_uintptr _t"
C:/python24/include/pyport.h:69: warning: type defaults to `int'
in declaration of `Py_uintptr_t'
C:/python24/include/pyport.h:69: warning: data definition has
no type or storage class
C:/python24/include/pyport.h:70: parse error before "Py_intptr_ t"
C:/python24/include/pyport.h:70: warning: type defaults to `int'
in declaration of `Py_intptr_t'
C:/python24/include/pyport.h:70: warning: data definition has
no type or storage class
error: command 'gcc' failed with exit status 1
That is, I don't even get to my _own_ broken code.
#if _MSC_VER > 1200
#define HAVE_UINTPTR_T 1 Is there a better test I can do at compile time?


Depends on what you want to test for. If it is
presence of stdint.h, you should test for
HAVE_STDINT_H.

Regards,
Martin


How is this as a change:

From this:
#ifdef MS_WIN32
...
/* VC 7.1 has them and VC 6.0 does not. VC 6.0 has a version
number of 1200. If some compiler does not provide them,
modify the #if appropriately. */
#if _MSC_VER != 1200
#define HAVE_UINTPTR_T 1
#define HAVE_INTPTR_T 1
#endif

#endif
To this:

#ifdef MS_WIN32
...
/* VC 7.1 has them and VC 6.0 does not. VC 6.0 has a version
number of 1200. If some compiler does not provide them,
modify the #if appropriately. */
#if _MSC_VER > 1200
#define HAVE_UINTPTR_T 1
#define HAVE_INTPTR_T 1
#elif HAVE_STDINT_H
#define HAVE_UINTPTR_T 1
#define HAVE_INTPTR_T 1
#endif

#endif
Or if HAVE_STDINT_H is defined under VC 7.1 (I cannot check that)
perhaps the change should become:

#ifdef MS_WIN32
...

#if HAVE_STDINT_H
#define HAVE_UINTPTR_T 1
#define HAVE_INTPTR_T 1
#endif

#endif

In any case, thanks for the help so far.

-Scott David Daniels
Sc***********@A cm.Org
Jul 18 '05 #10

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

Similar topics

2
10572
by: Donald Firesmith | last post by:
I am having trouble having Google Adsense code stored in XSL converted properly into HTML. The <> unfortunately become &lt; and &gt; and then no longer work. XSL code is: <script type="text/javascript"> <!]> </script> <script type="text/javascript"
11
5162
by: Scott Brady Drummonds | last post by:
Hi, everyone, I've checked a couple of on-line resources and am unable to determine how reinterpret_cast<> is different from static_cast<>. They both seem to perform a compile-time casting of one type to another. However, I'm certain that there is something else that is happening. Can someone explain the difference or recommend an online site that can explain it to me?
2
1875
by: Martin Hvidberg | last post by:
Dear list I have found a declaration like this: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <math.h> #include "ectemp.h"
3
1732
by: z. f. | last post by:
Hi, i'm using code in my aspx page. i have data binding where i use <%# Container.DataItem("DateStart") %> i also use code that makes a loop inside a regular <% %> block how can i pass data from the databinding to the loop that runs in a regular
11
2808
by: Randy | last post by:
What is C++'s equivalent of ISO C99's stdint.h? --RY
9
3691
by: Simple Simon | last post by:
Java longs are 8 bytes. I have a Java long that is coming in from the network, and that represents milliseconds since Epoch (Jan 1 1970 00:00:00). I'm having trouble understanding how to get it into a struct timeval object. I get the ByteBuffer as an array of const unsigned char, 'buffer'. Here's an example: 00 00 01 0A 29 1D 07 E4 This value maps somehow to Thu Mar 23 16:57:49 2006 and some
3
3386
by: ajay2552 | last post by:
Hi, I have a query. All html tags start with < and end with >. Suppose i want to display either '<' or '>' or say some text like '<Company>' in html how do i do it? One method is to use &lt, &gt ,&ltCompany&gt to display '<', '>' and '<Company>' respectively. But is there any freeware code available which could implement the above functionality without having to use &gt,&lt and such stuff???
3
2945
by: newbie | last post by:
Same thing g++ complains when using hash_map<>, but is happy with map<--I understand hahs_map is not standardized, but since the compiler didn't complain something like 'hash_map<not defined', I suppose it's supported and should behave well when I used it correctly. BUT it didn't. Here is my code snippet: class MyKey { public: virtual void foo() { return; }
130
6826
by: euler70 | last post by:
char and unsigned char have specific purposes: char is useful for representing characters of the basic execution character set and unsigned char is useful for representing the values of individual bytes. The remainder of the standard integer types are general purpose. Their only requirement is to satisfy a minimum range of values, and also int "has the natural size suggested by the architecture of the execution environment". What are the...
0
9706
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, 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...
0
10330
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10076
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7616
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 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...
0
6851
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();...
0
5520
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3816
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2990
bsmnconsultancy
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...

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.