Data types in samba4

Tim Potter tpot at samba.org
Sun Jan 18 04:29:53 GMT 2004


On Fri, Jan 16, 2004 at 01:20:07PM +0000, Andrew Bartlett wrote:

> I think we need to be careful with this.  We don't want to be casting
> every printf(), so we are constrained in the types we should be using.
> For example, we should ensure that we make very good use of the 'int'
> and 'unsigned int' types in particular, as these are the most common
> to pass to printf().  

A lot of the usage of int can be converted to a fixed-width type as 
loop counters etc are going to be operating on data that has come off 
the wire and is by definition going to fit into a fixed width type.

> That is to say, we have good printf warnings on some compilers - but
> if we play casty-foo with every printf, we will stuff it up at some
> point, and the results may not be pretty.

If you assume LP64 then there isn't very much to do, in fact I've
already done it!  I.e only longs and pointers are 64 bits (cast
required or use %p) and int/short/char are 32/16/8-bits (no cast 
necessary).

> Natually, where we have wire types, we should use it, and I don't
> object to using the standard names for such data.

That's what we aren't doing at the moment.

Certainly a search and replace of uint{32,16,8} -> uint{32,16,8}_t
would work right now.


Tim.


More information about the samba-technical mailing list