Re: [gtk-list] Re: How to use a gpointer?
- From: Ulric Eriksson <ulric edu stockholm se>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re: How to use a gpointer?
- Date: Sat, 6 Mar 1999 11:39:10 +0100 (CET)
On Fri, 5 Mar 1999, Lars Hallberg wrote:
> On Fri, Mar 05, 1999 at 02:52:20PM +0100, Ulric Eriksson wrote:
> > To settle this once and for all, wouldn't it be a good idea to simply
> > replace "typedef int gint" with "typedef gint32 gint" in glib.h?
> C standard (as I remeber, been C++ hacker for eternity ;-) says that int
> supose to be the prefered size of integer type on the system. That mens
Close: it is the "natural size suggested by the architecture of the
> not only the processor but the complet system is faster with memory
> transfer cost and all. If a 64bit int makes sens 64 bit void * will
> probably also make sens (even if the adress space hardly be neded ;-).
> So sizeof(int) <= sizeof(void *) is likly to hold exept for werry
> exotic systems that can be handled as found. Defining gint as gint32
> may be unnasasary suboptimal on a system that actuly is faste with 64
> bit ints and use 64 bit void *.
No, because int will still be int.
One can either say that gint is a synonym for int, which is IMO a waste of
namespace, or one can say that gint is an integer type which can be
converted to a pointer and back. Not both. Not at the same time. Not in C.
> OTOH cross platform applikation can't rely on an int to be biger then
> 32 bit for a good while longer. That men defining gint as gint32 will
> only be potensial suboptimal - not a disaster ;-) in short terms.
It will be neither suboptimal nor a disaster. It will be a kludge to
ensure that gint is small enough to fit in most 32-bit pointers, without
breaking existing code.
] [Thread Prev