From owner-freebsd-arch Wed Oct 9 10:31:15 2002 Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3DA3537B401; Wed, 9 Oct 2002 10:31:14 -0700 (PDT) Received: from canning.wemm.org (canning.wemm.org [192.203.228.65]) by mx1.FreeBSD.org (Postfix) with ESMTP id 04F6343E42; Wed, 9 Oct 2002 10:31:10 -0700 (PDT) (envelope-from peter@wemm.org) Received: from wemm.org (localhost [127.0.0.1]) by canning.wemm.org (Postfix) with ESMTP id 9D1862A88D; Wed, 9 Oct 2002 10:31:06 -0700 (PDT) (envelope-from peter@wemm.org) X-Mailer: exmh version 2.5 07/13/2001 with nmh-1.0.4 To: Bruce Evans Cc: Mike Barcroft , Andrew Gallatin , freebsd-arch@FreeBSD.ORG Subject: Re: lp64 vs lp32 printf In-Reply-To: <20021009161756.E4040-100000@gamplex.bde.org> Date: Wed, 09 Oct 2002 10:31:06 -0700 From: Peter Wemm Message-Id: <20021009173106.9D1862A88D@canning.wemm.org> Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Bruce Evans wrote: > On Tue, 8 Oct 2002, Mike Barcroft wrote: > > > Andrew Gallatin 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). 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. :-( Cheers, -Peter -- Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com "All of this is for nothing if we don't go to the stars" - JMS/B5 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message