svn commit: r253402 - head/tools/regression/aio/aiop

Bruce Evans brde at
Wed Jul 17 08:03:23 UTC 2013

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.


More information about the svn-src-head mailing list