Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 2 Nov 2014 11:46:14 +1000
From:      Paul Koch <paul.koch@akips.com>
To:        Julian Elischer <julian@freebsd.org>
Cc:        Freebsd hackers list <freebsd-hackers@freebsd.org>
Subject:   Re: how to kernel printf a int64_t?
Message-ID:  <20141102114614.38aa9034@akips.com>
In-Reply-To: <54558778.7050500@freebsd.org>
References:  <439339249.2551223.1414702876172.JavaMail.root@uoguelph.ca> <97A82163-E78D-457E-B649-B243B41A6C6F@kientzle.com> <54558778.7050500@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 02 Nov 2014 09:23:04 +0800
Julian Elischer <julian@freebsd.org> wrote:

> On 10/31/14, 1:09 PM, Tim Kientzle wrote:
> > On Oct 30, 2014, at 2:01 PM, Rick Macklem <rmacklem@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20141102114614.38aa9034>