Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 5 Jun 2011 11:30:36 -0700
From:      mdf@FreeBSD.org
To:        Ben Laurie <ben@links.org>
Cc:        hackers@freebsd.org
Subject:   Re: int64_t and printf
Message-ID:  <BANLkTimCvrJjm741%2BCEOafHapqsS3-m%2Bnw@mail.gmail.com>
In-Reply-To: <4DEBC741.1020200@links.org>
References:  <4DEBC741.1020200@links.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Jun 5, 2011 at 11:13 AM, Ben Laurie <ben@links.org> wrote:
> So, for example int64_t has no printf modifier I am aware of. Likewise
> its many friends.

The worse option is to use the C99 defines, like PRI64 and PRI64U.
The better option is to use %jd / %ju and cast the value to
[u]intmax_t.

Cheers,
matthew

> In the past I've handled this by having a define somewhere along the
> lines of...
>
> #if <something>
> # define INT_64_T_FMT "%ld"
> #else
> # define INT_64_T_FMT "%lld"
> #endif
>
> but I have no idea where to put such a thing in FreeBSD. Opinions? Also,
> I guess I'd really need to do a modifier rather than a format, for full
> generality.
>
> --
> http://www.apache-ssl.org/ben.html =A0 =A0 =A0 =A0 =A0 http://www.links.o=
rg/
>
> "There is no limit to what a man can do or how far he can go if he
> doesn't mind who gets the credit." - Robert Woodruff
> _______________________________________________
> 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=
"
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BANLkTimCvrJjm741%2BCEOafHapqsS3-m%2Bnw>