Date: Thu, 18 Jul 2013 09:50:34 +0800 From: Kevin Lo <kevlo@FreeBSD.org> To: Bruce Evans <brde@optusnet.com.au> 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: <51E749EA.7000807@FreeBSD.org> In-Reply-To: <20130717174435.C1577@besplex.bde.org> References: <201307170054.r6H0sLEc065384@svn.freebsd.org> <20130717174435.C1577@besplex.bde.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?51E749EA.7000807>
