[OpenAFS-devel] [PATCH] flexelint: fun with printf

Ted Anderson TedAnderson@mindspring.com
Mon, 01 Dec 2003 10:10:55 -0500


On 11/21/2003 14:45, Joe Buehler wrote:
> This patch addresses a number of problems with printf-like functions.

I don't know how the gatekeepers feel about this recent spate of 
patches, but it seems like a valuable and overdue effort.  Thanks.

> Most of them are %x formats applied to pointers (which could be a
> problem depending on the architecture I would assume).  There is a
> %p format for pointers on many machines but I don't know if it
> applies to all supported OpenAFS platforms so I didn't go that route.

 > -	afsi_log("osi_LogCreate log addr %x", afsd_logp);
 > +	afsi_log("osi_LogCreate log addr %x", (int)afsd_logp);

I think it would be more correct, and still portable, to use long 
instead of int to represent pointers.  I don't know it C mandates it, 
but I think the wide-spread convention is that longs are at least as big 
as pointers, while the size of ints vary more widely.  So this would 
lead to code like this:

	afsi_log("osi_LogCreate log addr %lx", (long)afsd_logp);

Ted Anderson