Subject: Re: PPS diffs, round #4 -- really u_char, u_intXX_t, etc
To: None <jonathan@DSG.Stanford.EDU, thorpej@nas.nasa.gov>
From: Chris Torek <torek@BSDI.COM>
List: tech-kern
Date: 04/22/1998 17:31:49
A bit of background:

The ANSI C9X drafts currently (as far as I know) use uintXX_t
as "exact width" types and "uintXX_least_t" as "at least" types;
POSIX uses {u or u_}intXX_t and ...XXm_t for "at least" types.
(I have never been all that thrilled with all the various name
spaces, and the minor but annoying differences between C9X and
POSIX just make things worse.  But that is another rant entirely. :-) )

When it comes to storing a value that will be "at most 8 bits"
in a variable that does not have to be any particular size, I
would just go with u_char myself.  The language guarantees that
this will be at least 8 bits, possibly more, and presumably it
will be a reasonably efficient version of "at least 8 bits".  If
you wanted to be explicit, you could use a POSIX-ey:

	u_int8m_t sc_foo;

to get an "8-or-more-bits-with-mostly-efficient-access" variable.

The device registers themselves, of course, are probably best
declared as "u_int8_t", which might be a special compiler-internal
type on machines with 32-bit "char"s.

Chris