[ENet-discuss] int types used in enet

Zac Evans karadoc at gmail.com
Wed Oct 6 04:21:26 PDT 2010


This is just a minor point...

I notice that ENet defines a bunch of int types that are used throughout the
library. They are defined like this:

typedef unsigned char enet_uint8;       /**< unsigned 8-bit type  */
typedef unsigned short enet_uint16;     /**< unsigned 16-bit type */
typedef unsigned int enet_uint32;      /**< unsigned 32-bit type */

I think it would be better if ENet didn't use these types, and instead used
the types defined in <stdint.h>. uint32_t, uint16_t, and uint8_t. (intptr_t
might also be appropriate in some places.) These standard types are defined
in exactly the same way as the enet types but they have the benefit of being
maintained by the standard library rather than by enet developers. So for
example, when using enet with an usual compiler, "enet_uint32" might
actually end up being 64 bits, whereas uint32_t is guaranteed by C99 to be
32 bits.

I don't think this will end up being a problem, but I still think it's a
good idea to make use of the standards to protect against even unlikely
possible future problems.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cubik.org/pipermail/enet-discuss/attachments/20101006/9cc93610/attachment.html>


More information about the ENet-discuss mailing list