On 2012.08.22 11:21, Hans de Goede wrote:
> I would prefer to stick with the __u32, as that is what is in the kernels
> *userspace* headers

It's 2012, C99 + stdint.h have been around for more than decade [1], 
and, unlike what may be the case for kernel developers who may worry 
about C89 compatibility, we very much rely on that header being 
available always in libusbx (#include <stdint.h> is part of libusb.h).

Thus, unless uint32_t and __u32 present incompatibilities on some Linux 
platforms, in my view, using __u32 when uint32_t would do is really akin 
to doing something like:
    #define integer int
and then proceed to use 'integer' in lieu of 'int' in your source.

We already brought stdint.h types to very C99-reluctant platforms, such 
as (older) MSVC's, so unless there's a technical reason not to use 
uint32_t on Linux, I would *strongly* advise that we stick to C99 stdint 
types. Makes it easier for everyone to follow our code, with one of the 
rationale being that, if we go with __u32 above, someone may wonder why 
we didn't go with uint32_t there, and waste time on a pointless search.

Besides, if after 10 years availability and countless evidence of 
reinvention of the wheel for ## bit types, even if noone else is going 
to promote stdint.h types, I sure as hell will.

> which we need anyways for the _IOWR / _IOR / _IOW macros.

except there isn't a C standard that sets a common definition for _IOWR 
and friends, so it's a different issue.

> Ideally we would not have linux_usbfs.h at all, and instead
> use "#include <linux/usbdevice_fs.h>", but that will break things if
> that header is too old, so we're stuck with a private copy of that file...

This, I see no problem with. When there's no choice, you do what you 
have to do. But for uint32_t vs __u32 we do have a choice, and one of 
them is part of an actual C standard...

Regards,

/Pete


[1] http://en.wikipedia.org/wiki/C_standard_library#Header_files


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel

Reply via email to