mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nikita Danilov <nikita@clusterfs.com>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: Jan Engelhardt <jengelh@linux01.gwdg.de>,
	torvalds@osdl.org, linux-kernel@vger.kernel.org,
	Al Viro <viro@ftp.linux.org.uk>
Subject: Re: [PATCH] use %p for pointers
Date: Thu, 12 Oct 2006 15:03:58 +0400	[thread overview]
Message-ID: <17710.8478.278820.595718@gargle.gargle.HOWL> (raw)
In-Reply-To: <452D3BB6.8040200@zytor.com>

H. Peter Anvin writes:
 > Al Viro wrote:
 > > 
 > > %p will do no such thing in the kernel.  As for the difference...  %x
 > > might happen to work on some architectures (where sizeof(void *)==sizeof(int)),
 > > but it's not portable _and_ not right.  %p is proper C for that...
 > 
 > It's really too bad gcc bitches about %#p, because that's arguably The 
 > Right Thing.

Hm...

man 3 printf:

       p      The void * pointer argument is printed in hexadeci-
              mal (as if by %#x or %#lx).

so %p already has to output '0x', it's lib/vsprintf.c to blame for
non-conforming behavior. What about

Signed-off-by: Nikita Danilov <danilov@gmail.com>

Index: git-linux/lib/vsprintf.c
===================================================================
--- git-linux.orig/lib/vsprintf.c
+++ git-linux/lib/vsprintf.c
@@ -408,7 +408,7 @@ int vsnprintf(char *buf, size_t size, co
 				}
 				str = number(str, end,
 						(unsigned long) va_arg(args, void *),
-						16, field_width, precision, flags);
+						16, field_width, precision, flags|SPECIAL);
 				continue;
 
 


  parent reply	other threads:[~2006-10-12 11:04 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-10 21:49 Al Viro
2006-10-10 21:58 ` David Miller
2006-10-11 11:16 ` Jan Engelhardt
2006-10-11 14:54   ` Al Viro
2006-10-11 18:45     ` H. Peter Anvin
2006-10-11 19:13       ` Jan Engelhardt
2006-10-11 19:16         ` H. Peter Anvin
2006-10-11 19:28           ` Jan Engelhardt
2006-10-11 20:28       ` Jakub Jelinek
2006-10-11 20:39         ` H. Peter Anvin
2006-10-12 11:03       ` Nikita Danilov [this message]
2006-10-12 11:49         ` Andreas Schwab
2006-10-12 12:02           ` Nikita Danilov
2006-10-12 12:33             ` Jan Engelhardt
2006-10-15 15:39         ` Jan Engelhardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=17710.8478.278820.595718@gargle.gargle.HOWL \
    --to=nikita@clusterfs.com \
    --cc=hpa@zytor.com \
    --cc=jengelh@linux01.gwdg.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    --cc=viro@ftp.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®