From owner-freebsd-arch Tue Oct 8 23:13:46 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 4FBAB37B401; Tue, 8 Oct 2002 23:13:45 -0700 (PDT) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id 33A6343E4A; Tue, 8 Oct 2002 23:13:44 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id QAA13743; Wed, 9 Oct 2002 16:13:42 +1000 Date: Wed, 9 Oct 2002 16:23:46 +1000 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Mike Barcroft Cc: Andrew Gallatin , Subject: Re: lp64 vs lp32 printf In-Reply-To: <20021008203120.K97120@espresso.q9media.com> Message-ID: <20021009161756.E4040-100000@gamplex.bde.org> 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 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). To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message