[Xcb] Using C99 types instead of custom integral types

Josh Triplett josh at freedesktop.org
Wed Sep 6 08:02:06 PDT 2006


Bernardo Innocenti wrote:
> I wrote a small XCB program just to try it out.  While I'm generally
> happy with the new API, the use of the ancient X typedefs for integral
> types such as INT32, CARD32 and BYTE make client code less readable to
> anybody except old X hackers.
> 
> I'd like to suggest adopting the standard C99 types instead, such as
> int8_t, int32_t, etc.

From xcb.h:
> #ifndef XMD_H
> typedef uint8_t  BYTE;
> typedef uint8_t  BOOL;
> typedef uint8_t  CARD8;
> typedef uint16_t CARD16;
> typedef uint32_t CARD32;
> typedef int8_t   INT8;
> typedef int16_t  INT16;
> typedef int32_t  INT32;
> #endif /* XMD_H */

We must provide those typedefs to allow old code to compile, but you
don't need to use them in your code.  If you prefer to use the C99 types
in your program, they will work perfectly well, and interoperate with
these typedefs.

This does raise the question of whether we might want to use these types
in our protocol headers rather than the typedefs.

- Josh Triplett

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
Url : http://lists.freedesktop.org/archives/xcb/attachments/20060906/68e9ed5b/signature.pgp


More information about the Xcb mailing list