Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 1 Nov 2014 22:14:45 -0400 (EDT)
From:      Rick Macklem <rmacklem@uoguelph.ca>
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:  <604180572.3888597.1414894484998.JavaMail.root@uoguelph.ca>
In-Reply-To: <54558778.7050500@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Julian Elischer wrote:
>=20
> On 10/31/14, 1:09 PM, Tim Kientzle wrote:
>=20
>=20
> On Oct 30, 2014, at 2:01 PM, Rick Macklem <rmacklem@uoguelph.ca>
> wrote:
>=20
> Hi,
>=20
> I feel kinda dumb asking this, but...
>       int64_t i;
>=20
>       printf("%qd\n", (u_quad_t)i);
>=20
> 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:
>=20
>     printf(=E2=80=9C%jd\n=E2=80=9D, (intmax_t)i); the "cannonical' way is=
 to use
>     PRIu64 and friends, but some people seem to have a problem with
>     doing that.
>=20
Ok, so now I need to ask another dumb question.
How do you do this in the kernel?
(I can see them defines in <machine/_inttypes.h>, but including that
 doesn't help, which isn't surprising since PRIu64 is in a string
 and won't be recognized as a macro.)

Oh, and is intmax_t going to be int64_t on all arches?

Thanks, rick

>=20
>=20
> Tim
>=20
> _______________________________________________
> freebsd-hackers@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To
> unsubscribe, send any mail to
> "freebsd-hackers-unsubscribe@freebsd.org"
>=20



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