I didn't see this come through the list.  Excuse me if it is a duplicate
because I'm having some minor mail problems.

On 05 Jul 2001 21:54:22 +0200, Christoph Egger wrote:
> 
> On 5 Jul 2001, Thayne Harbaugh wrote:
> 
> > I'm going to open a can of worms.  include/ggi/system.h does this:
> > 
> > typedef signed int int32;
> > typedef unsigned int uint32;
> > 
> > Why is this int?  I know that there is no guarantee for the size of int
> > and the size of long, but I think that long is more often 32 bits and is
> > (somewhat) more correct.
> 
> <ggi/system.h> is always correct, because it is autogenerated by
> configure.
>  
> > Furthermore it seems that many headers always want to reinvent the wheel
> > when it comes to these typedefs.  Why doesn't GGI just "#include
> > <sys/types.h>" ?  It provides the following:
> > 
> > typedef char int8_t;
> > typedef short int int16_t;
> > typedef int int32_t;
> > 
> > typedef unsigned char u_int8_t;
> > typedef unsigned short int u_int16_t;
> > typedef unsigned int u_int32_t;
> 
> I don't know. The decision was made, before I came to GGI. I guess,
> platform independence is the reason.

ISO C99 types in <stdint.h> seem like what should be used (more
standard) and then configure can try to include <stdint.h> if
successfull or equivalent substitute headers from ggi if <stdint.h>
isn't available.

>  
> > If the argument is that not every platform provides these then couldn't
> > it be "discovered" in the configure stage and the proper header file
> > built at that time?
> > 
> > 
> > I propose, at very least, the following change.
> > 
> > 
> > --- system.h.orig   Tue Jul  3 10:14:36 2001
> > +++ system.h        Thu Jul  5 13:24:51 2001
> > @@ -55,8 +55,8 @@
> >  typedef signed short sint16;
> >  typedef unsigned short uint16;
> >  
> > -typedef signed int sint32;
> > -typedef unsigned int uint32;
> > +typedef signed long sint32;
> > +typedef unsigned long uint32;
> 
> That's wrong, because on 64bit architectures "long" is 64bit wide.

I thought that int was the "natural size" for an architecture?  This is
why the C99 standard should be used.

The other problem is that many pieces of sotware do the wrong thing and
define their own substitutes.  This can cause typedef collisions when
mixing - these aren't the same:

typedef unsinged int uint32_t
typedef unsigned long uint32_t

If this problems is fixed it should really go into a point release.
   
> >  typedef    signed int              ggi_sint;
> >  typedef unsigned int               ggi_uint;
> > 
>  
> 
> CU,
> 
> Christoph Egger
> E-Mail: [EMAIL PROTECTED]

-- 
Thayne Harbaugh

Reply via email to