Re: [RFC/PATCH v6 02/12] media: Media device

From: Alan Cox
Date: Thu Nov 25 2010 - 13:07:40 EST


On Thu, 25 Nov 2010 12:20:31 -0500
Andy Walls <awalls@xxxxxxxxxxxxxxxx> wrote:

> The signedness of char is ambiguous for 8 bit data, which is why an API would normally use u8 (or s8, I guess).
>
> Since this is known to be character data, I would think char would be fine. I am assuming C compilers would never assume multibyte "char"s.

char is 8bit in all modern C. I have used C compilers with configurable 9
or 7 bit char and such a machine is never going to run Linux without
serious insanity. Even grep in 9bit char is not fun...

The advantage of using u8 is that any casting goes the way you expect
whereas when working with UTF-8 things like

int x = name[0];

may not produce the expected result otherwise.

Alan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/