samba4: unsigned char -> uint8

Christopher R. Hertel crh at ubiqx.mn.org
Sun May 30 06:48:34 GMT 2004


On Sun, May 30, 2004 at 09:36:03AM +1000, tridge at samba.org wrote:
>  > Then why not 'unsigned char'.  But you have already committed that
>  > change...
> 
> I think that "uint8_t *" is much better than "unsigned char *" when
> what we want is an array of bytes. It makes it very clear that we are
> treating the data as bytes, for routines like hashing, raw packets
> etc. The other obvious alternative would be "byte_t", but given that
> uint8_t is defined as a standard, I think its a better choice.
> 
> If what we want is a string, then "char *" is the right choice. 

Some systems default to 'char' being signed, while others make it
unsigned.  That's caught me off guard a few times, particularly when using
'char *' to point to buffers for things like encryption.

> I also quite like uint_t, for non-wire integers that need to be
> unsigned. I find it very clear and easy to read in code. For signed
> non-wire integers "int" is fine.

I don't see uint_t in stdint.h, so I'm assuming this is something we would 
add.

Chris -)-----

-- 
"Implementing CIFS - the Common Internet FileSystem" ISBN: 013047116X
Samba Team -- http://www.samba.org/     -)-----   Christopher R. Hertel
jCIFS Team -- http://jcifs.samba.org/   -)-----   ubiqx development, uninq.
ubiqx Team -- http://www.ubiqx.org/     -)-----   crh at ubiqx.mn.org
OnLineBook -- http://ubiqx.org/cifs/    -)-----   crh at ubiqx.org


More information about the samba-technical mailing list