Re: [AD] unicode.c patch

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Jason Wilkins <fenix@xxxxxxxxxx> writes:

> > i think it would be a good idea to start using the new iso c types. see
> > /usr/include/stdint.h to see what i mean. this way we ensure portability of
> > code as well. allegro makes too much assumptions about the size of int beeing
> > 32bits. on my old borland compiler the size was 16bit. on ia64 it might be
> > 64bit. instead of making a workaround for a cvs version of gcc wouldn't it be
> > a good idea to actually fix this properly once and for all?
> 
> This idea has been shot down a dozen times, and never for a good reason
> (IMHO of course).  I say we go ahead and do it, now that there is a
> standard.  We can just create our own header for any platforms that don't
> support the standard.

Just to make clear, this patch was about C convention for passing
short as int, not about portable types.

IMHO, C had good standard for integer types for a long time:

sizeof (char) <= sizeof (short) <= sizeof (int) <= sizeof (long)
unsigned char is at least 8 bit,
unsigned short is at least 16 bit,
unsigned long is at least 32 bit.

I think, this is enough for most cases where portable integer data
types are needed.  AFAICS, the only problem is passing signed integers
between platforms with different representation for signed values.

I don't have documentation for C standard with these new data types.
Are they defined to be exactly that number of bits, or at least that
number of bits?  Is certain C integer type defined, if platform does
not have integer type with that number of bits?  Does new standard
have any recommendations how and where to use these new types?
If these types are exactly that number of bits, then they will not add
portability (some conditionals will be necessary).  If they are at
least that number of bits, then they don't add anything to portability
over usual standard for integer data types.

In short, I think it is a good idea to rewrite API with portable data
types, but I'm not sure about these new standard types.

-- 
Michael Bukin



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/