Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 09 Oct 2002 14:30:29 -0400 (EDT)
From:      John Baldwin <jhb@FreeBSD.org>
To:        Andrew Gallatin <gallatin@cs.duke.edu>
Cc:        Peter Wemm <peter@wemm.org>, freebsd-arch@FreeBSD.org
Subject:   Re: lp64 vs lp32 printf
Message-ID:  <XFMail.20021009143029.jhb@FreeBSD.org>
In-Reply-To: <15780.28996.936657.152472@grasshopper.cs.duke.edu>

next in thread | previous in thread | raw e-mail | index | archive | help

On 09-Oct-2002 Andrew Gallatin wrote:
> 
> John Baldwin writes:
>  > 
>  > On 09-Oct-2002 Andrew Gallatin wrote:
>  > > 
>  > > Peter Wemm writes:
>  > >  > > 
>  > >  > > Um, using intmax_t to print size_t's would be incorrect, since it is
>  > >  > > signed.  Using uintmax_t would be bloat.  Very few typedefed types
>  > >  > > need the full bloat of [u]intmax_t, and size_t is unlikely to become
>  > >  > > one of them before casting it to uintmax_t to print it becomes a style
>  > >  > > bug in the kernel too (when %z is implemented).
>  > >  > 
>  > >  > Bring it on!  The sooner %z gets here the better.  The only problem is that
>  > >  > gcc has been taught that %z means something different in the kernel. :-(
>  > > 
>  > > Where is gcc taught these things?  Can we update it?
>  > 
>  > We should be able to change the kernel %z to some other weird letter.
> 
> Sure.. but do you know where in the sources %z is defined to be
> something weird?

sys/kern/subr_prf.c in the kernel, and in the -fformat-extensions local
patches stuff for gcc.  I think the gcc work wouldn't be too difficult
to do since it would just be renaming a letter.  Hmm, I was incorrect
(my grep re was busted) and %z is actually used in two places in ddb.
We can either pick a letter to use or just use %x with explicit signs
in those two cases:

ddb/db_examine.c:                               db_printf("%-*lz", width, (long)value);
ddb/db_examine.c:               db_printf("%8lz", (long)addr);

Hmm, the second case doesn't even use a sign so it can be %x anyways.

-- 

John Baldwin <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.20021009143029.jhb>