From owner-freebsd-arch Wed Oct 9 12:11:10 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 BF22237B401 for ; Wed, 9 Oct 2002 12:11:09 -0700 (PDT) Received: from rootlabs.com (root.org [67.118.192.226]) by mx1.FreeBSD.org (Postfix) with SMTP id 659EF43E4A for ; Wed, 9 Oct 2002 12:11:09 -0700 (PDT) (envelope-from nate@rootlabs.com) Received: (qmail 14803 invoked by uid 1000); 9 Oct 2002 19:11:10 -0000 Date: Wed, 9 Oct 2002 12:11:10 -0700 (PDT) From: Nate Lawson To: Bruce Evans Cc: freebsd-arch@FreeBSD.ORG Subject: Re: lp64 vs lp32 printf In-Reply-To: <20021009161756.E4040-100000@gamplex.bde.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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 On Wed, 9 Oct 2002, 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). 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