At 12:01 PM -0500 12/2/03, [EMAIL PROTECTED] wrote:
Date: Mon, 1 Dec 2003 18:22:27 +0100
From: Joerg Sonnenberger <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: Re: [OpenAFS-devel] [PATCH] flexelint: fun with printf

On Mon, Dec 01, 2003 at 10:10:55AM -0500, Ted Anderson wrote:
 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);

What about: afsi_log("osi_LogCreate log addr %p", (void*)afsd_logp);

The BSD man page doesn't mention %p as non portable, so it may be the
correct way.

Joerg


> Ted Anderson

Well someone posted it worked for Windows. I can confirm it's there for OSX and NetBSD, and Solaris. That's starting to look like good coverage.


Any other takers?
--
The opinions expressed in this message are mine,
not those of Caltech, JPL, NASA, or the US Government.
[EMAIL PROTECTED], or [EMAIL PROTECTED]
_______________________________________________
OpenAFS-devel mailing list
[EMAIL PROTECTED]
https://lists.openafs.org/mailman/listinfo/openafs-devel

Reply via email to