Re: gsize vs. size_t



Joel Becker <jlbec evilplan org> writes:

> On Tue, Feb 19, 2002 at 04:39:20PM +0100, Miroslaw Dobrzanski-Neumann wrote:
> > Hi
> > I get the followin errors when compiling on AIX
> > 
> > it is because size_t is unsigned long and gsize is unsigned int at when calling g_iconv()
> > 
> > glib-1.3.14/glib/giochannel.c
> > 
> > xlc_r -DHAVE_CONFIG_H -I. -I. -I.. -I.. -DG_LOG_DOMAIN=\"GLib\" -DG_ENABLE_DEBUG -DG_DISABLE_DEPRECATED -DGLIB_COMPILATION -I/net/DAGOBERT/dataE3/bef/mne/SYSTEM/include -g -D_REENTRANT -D_THREAD_SAFE -c giochannel.c  -DPIC
> > "giochannel.c", line 1246.51: 1506-280 (E) Function argument assignment between types "unsigned int*" and "unsigned long*" is not allowed.
> 
> 	Yay ANSI!  What's happening here is that configure.in does
> GLIB_SIZEOF(size_t).  That does sizeof(size_t), which is 4 on a 32-bit
> RS/6000.  configure.in then does:
> 
> case x$glib_size_t in
>    x4) typedef guint32 gsize
> 
> But because ints are 32 bits, guint32 is typedef unsigned int guint32.
> So, the resolved typedefs are:
> 
> typedef unsigned long size_t
> typedef unsigned int gsize
> 
> These are the same size (32 bits), but the compiler notices they are
> different types and is very strict in warning.
> 	This isn't going to go away unless glib gets a macro to use the
> string definition of size_t or something else like that.  I don't see it
> happening in the near term.  You can ignore these warnings, or you can
> hunt up the right -q option to lower your warning level.

I think we can add a special hack to configure to make sure that gsize
and gssize are defined as long if size_t is defined as long, if someone
comes up with the appropriate hack.

Regards,
                                        Owen



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]