[LinuxBIOS] difference between uint16_t and u16

Carl-Daniel Hailfinger c-d.hailfinger.devel.2006 at gmx.net
Thu Aug 30 04:43:32 CEST 2007


On 30.08.2007 03:54, matt wrote:
> i have noticed several patches signed off on the list that change data
> types from uint16_t to u16 and the like (8 .. 32 bit signed and
> unsigned) and was wondering why ?  i thought uint16_t was c99
> standard ?  i asked the same thing on sdl's mailing list and was told
> that not all compilers support it.  with sdl that seems right since its
> a platform independent lib.  with linuxbios it seems that is not the
> case, i assume most or all would be using gcc.

There are several reasons:
* The Linux kernel uses u8, u16 etc.
* u_int32_t and uint32_t are both allowed in C99 (I have not verified
that) and we'd have to choose
* I can't remember whether it's u_int32_t, uint32_t, u_int32t etc.
* The _t at the end is superfluous and ugly
* The underscore disease is hampering all of them
* Calling unsigned char an int just because it sounds cool is stupid
* Unneeded redundancy
* u8, u16 etc. are shorter
  * Less typing needed for u8 etc.
  * Screen estate requirements are less for u8 etc.
* uint8_t looks a lot like
unsigned_int_well_not_really_it_s_char_that_s_why_we_included_the_8
* LinuxBIOS uses u8 in the BIOS codebase which is neither userspace code
nor can it use libraries.

> only reason i ask is that a standard header was added years ago and i
> still see custom data types.  just trying to understand that better.

I hope my opinion piece above provides sufficient reasons. ;-)

To comfort you, such switchovers are not planned for the userspace
utilities we ship. Yet.

Regards,
Carl-Daniel




More information about the coreboot mailing list