Bruce Evans wrote:
On Wed, 17 Jul 2013, Kevin Lo wrote:
Log:
Use PRId64 instead of %gd to print an int64_t.
This is a different printf format error, and a style bug.
Printf format errors:
commit log: %gd doesn't exist. You mean %qd
old: file_size has type off_t, but was printed using %qd. off_t is only
accidentally the same as quad_t
new: file_size has type off_t, but is printed using %PRId64. off_t is
only
accidentally the same as int64_t.
Style bug: the PRI* mistake should never be used.
Fix for printf format errors: don't assume anything about off_t except
its specification that it is a signed integer type. Convert it to
intmax_t
for printing.
Fix for style bug: use %jd to print the intmax_t.
The PRI* mistake is especially large for intmax_t and uintmax_t. It
lets you spell %jd as %PRIdMAX. PRI* is redundant for intmax_t and
uintmax_t because there is a format letter ('j') for these types. No
other PRI* has this redundancy bug. For example, there is no PRI* for
ssize_t or size_t. The format letter for these types ('z') handles
them better, just like the 'j' does for intmax_t and uintmax_t.
Fixed. Thanks for spotting that.
Bruce
Kevin
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"