Re: More 64bit issues (Was: Re: gtype.h broken for 64-bit)



On Mon, Nov 26, 2001 at 05:55:14PM +0100, Tim Janik wrote:
> hm, i adressed that above. on 32bit x86, the glibc
> headers do (or _can_ do):
> 	# define size_t          unsigned int
> 	void *malloc(size_t size);
> if glib then does
> 	#define gsize gulong
> you actually get a pointer mismatch with
> 	void* (*foo) (gsize) = malloc;
> or
> 	gsize *x = (size_t*) pointer;
> which is arguably quite irritating.

While that is irritating, I think it is the less common case.  Catching
long/int type mismatches is more important I think.  Although, it can
probably be quite perplexing to people if size_t doesn't seem compatible with
gsize.  I suppose either choice is bad in some respect, but I think that
having #define gsize guint on x86 leads to silent warnings.  People compiling
packages rarely look at warnings, so it's likely to lead to buggy code and
the developer never saw it coming.  If it's always gulong, there are some
irritating warnings, but also some 64bit problems are caught.

George

-- 
George <jirka 5z com>
   Supreme executive power derives from a mandate from the masses,
   not from some farcical aquatic ceremony.
                       -- Dennis (the bloody peasant)



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