[prototype-PATCH] Change CARDXX and INTXX defines to use stdint.h

Peter Harris peter.harris at hummingbird.com
Thu Jan 17 13:44:42 PST 2008


Maarten Maathuis wrote:
> An inconsistent CARD32 has been bothering me for some time (for printf
> alike functions you get warnings on some arches), so i propose
> switching the defines to using stdint. I have a few questions though:
> 
> 1: What is the purpose of UNSIGNEDBITFIELDS?

To support older platforms where B16 and B32 are required, but signed 
bitfields are not permitted.

> 2: What is the purpose of B32 and B16?

To support platforms (older Cray? Embedded DSP-like CPUs?) that do not 
have a native 16 or 32-bit integer.

> I attached a patch against x11proto, which i used on my x86_64 system
> to compile the xserver with (i did not recompile anything for testing
> ABI compatibility).
> 
> What do other people have to say about this?

stdint.h is a C99ism. As far as I know, the reference x11proto still 
targets C89.

If you were to only include and use stdint.h on platforms that are known 
to have a working C99 environment, that would be a much safer change.

 > +/* Why is INT8 always signed? */

Unlike INT16 and INT32, INT8 is not ever used in conjunction with B16 or 
B32, so it doesn't need to be unsigned when UNSIGNEDBITFIELDS is set.

Peter Harris
-- 
      Hummingbird Connectivity - A Division of Open Text
Peter Harris                    http://connectivity.hummingbird.com
Research and Development        Phone: +1 905 762 6001
peter.harris at hummingbird.com    Toll Free: 1 877 359 4866



More information about the xorg mailing list