samba4: unsigned char -> uint8
Christopher R. Hertel
crh at ubiqx.mn.org
Wed Jun 2 21:30:04 GMT 2004
On Wed, Jun 02, 2004 at 01:45:38PM -0600, Anthony Liguori wrote:
> Using uint_t and int_t may be a bad idea. The C99 standard specifically
> reverses the right to introduce new types that begin with int or uint and
> end with _t. There's no guarentee that their definition would be the same
> as ours either and that could produce compatibility problems moving
> forward. Currently int_t and uint_t are not defined in C99. Here's the
> relevant text from the standard:
> 7.26 Future library directions
> [#1] The following names are grouped under individual
> headers for convenience. All external names described below
> are reserved no matter what headers are included by the
> ... a little further down ...
> 7.26.8 Integer types <stdint.h>
> [#1] Type names beginning with int or uint and ending with
> _t may be added to the types defined in the <stdint.h>
> header. Macro names beginning with INT or UINT and ending
> with _MAX or _MIN, may be added to the macros defined in the
> <stdint.h> header.
> Should probably stick with int and unsigned int...
What about just "uint", since that doesn't end with "_t"?
> Anthony Liguori
> Linux/Active Directory Interoperability
> Linux Technology Center (LTC) - IBM Austin
> E-mail: aliguor at us.ibm.com
> Phone: (512) 838-1208
> Tie Line: 678-1208
> On Sat, May 29, 2004 at 10:29:39AM +1000, Andrew Bartlett wrote:
> > > > any objections when I convert 'unsigned char' to uint8
> > > > in samba4
> > > >
> > > > and 'unsigned' and 'unsigned int' to uint_t.
> > >
> > > That's OK with me.
> > Lets just make sure we don't take it too far - I don't want to see all
> > our string becoming 'int8 *' ;-)
> Agreed. For example there is a big difference between signed and
> unsigned char in some situations. I think there is a bit of a precedent
> for keeping char * and unsigned char * as they are a C idiom for working
> with strings.
> > Personally, I don't see the point in the short names for 'unsigned
> > int'. I understand the need for explicit 64 bit names in particular
> > (where various compilers call it a different thing) but what exactly was
> > wrong with 'unsigned int'?
> Again, I think it's a bit of a C idiom to use int and unsigned int for
> general use unless there is a pressing reason to use a fixed-width type
> (e.g marshalling/unmarshalling from the wire or working with quantities
> that have been taken from the wire).
> #### signature.asc has been removed from this note on June 02, 2004 by
> Anthony Liguori
"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