Date: Wed, 17 Jul 2013 18:03:10 +1000 (EST) From: Bruce Evans <brde@optusnet.com.au> To: Kevin Lo <kevlo@freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r253402 - head/tools/regression/aio/aiop Message-ID: <20130717174435.C1577@besplex.bde.org> In-Reply-To: <201307170054.r6H0sLEc065384@svn.freebsd.org> References: <201307170054.r6H0sLEc065384@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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.
Bruce
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130717174435.C1577>
