Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 9 Oct 2002 12:11:10 -0700 (PDT)
From:      Nate Lawson <nate@root.org>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        freebsd-arch@FreeBSD.ORG
Subject:   Re: lp64 vs lp32 printf
Message-ID:  <Pine.BSF.4.21.0210091210200.14413-100000@root.org>
In-Reply-To: <20021009161756.E4040-100000@gamplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 9 Oct 2002, Bruce Evans wrote:
> On Tue, 8 Oct 2002, Mike Barcroft wrote:
> 
> > Andrew Gallatin <gallatin@cs.duke.edu> writes:
> > >
> > > What's the accepted way to printf something (like sizeof()) which
> > > boils down to "unsigned int" on x86 and "unsigned long" on the LP64
> > > platforms?
> >
> > In userland you can use %z for printing size_t's.  In the kernel,
> > casting to intmax_t/uintmax_t and using %j is correct.
> 
> 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).

Ok, so back to Drew's original question.  What's the accepted way (both
kernel and user)?

-Nate


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?Pine.BSF.4.21.0210091210200.14413-100000>