atom feed24 messages in org.freebsd.freebsd-archRe: lp64 vs lp32 printf
FromSent OnAttachments
Andrew GallatinOct 8, 2002 5:26 pm 
Mike BarcroftOct 8, 2002 5:30 pm 
John BaldwinOct 8, 2002 6:22 pm 
Mike BarcroftOct 8, 2002 6:53 pm 
Bruce EvansOct 8, 2002 11:23 pm 
Peter WemmOct 9, 2002 10:30 am 
Andrew GallatinOct 9, 2002 10:32 am 
John BaldwinOct 9, 2002 11:03 am 
Andrew GallatinOct 9, 2002 11:10 am 
John BaldwinOct 9, 2002 11:20 am 
John BaldwinOct 9, 2002 11:30 am 
John BaldwinOct 9, 2002 11:39 am 
Nate LawsonOct 9, 2002 12:10 pm 
Bruce EvansOct 9, 2002 12:40 pm 
Bruce EvansOct 9, 2002 1:40 pm 
John BaldwinOct 9, 2002 1:44 pm 
Bruce EvansOct 9, 2002 2:04 pm 
David O'BrienOct 9, 2002 2:22 pm 
David O'BrienOct 9, 2002 3:05 pm 
Bruce EvansOct 10, 2002 12:16 am 
Bruce EvansOct 10, 2002 5:15 am 
John BaldwinOct 10, 2002 6:29 am 
David O'BrienOct 10, 2002 7:38 am 
John BaldwinOct 10, 2002 8:04 am 
Subject:Re: lp64 vs lp32 printf
From:Bruce Evans (bd@zeta.org.au)
Date:Oct 8, 2002 11:23:24 pm
List:org.freebsd.freebsd-arch

On Tue, 8 Oct 2002, Mike Barcroft wrote:

Andrew Gallatin <gall@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).

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