how to kernel printf a int64_t?

Paul Koch paul.koch at akips.com
Sun Nov 2 01:46:33 UTC 2014


On Sun, 02 Nov 2014 09:23:04 +0800
Julian Elischer <julian at freebsd.org> wrote:

> On 10/31/14, 1:09 PM, Tim Kientzle wrote:
> > On Oct 30, 2014, at 2:01 PM, Rick Macklem <rmacklem at uoguelph.ca> wrote:
> >
> >> Hi,
> >>
> >> I feel kinda dumb asking this, but...
> >>        int64_t i;
> >>
> >>        printf("%qd\n", (u_quad_t)i);
> >>
> >> works but looks dorky, to put it technically;-).
> >> Is there a better way to printf() a int64_t in the kernel?
> > I often use the following to print large integers:
> >
> >      printf(“%jd\n”, (intmax_t)i);
>
> the "cannonical' way is to use PRIu64  and friends, but some people 
> seem to have a problem with doing that.

We've always used the PRIxxx types when coding for both 32/64 platforms,
but it would have been really nice to have a standard way for time_t.
Something like PRItt

	Paul.
-- 
Paul Koch | Founder, CEO
AKIPS Network Monitor
http://www.akips.com
Brisbane, Australia


More information about the freebsd-hackers mailing list