grep-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Grep-devel] [PATCH] grep: use 'j' printf length modifier for [u]int


From: Jim Meyering
Subject: Re: [Grep-devel] [PATCH] grep: use 'j' printf length modifier for [u]intmax_t
Date: Sun, 16 Oct 2016 16:28:45 -0700

On Sun, Oct 16, 2016 at 12:13 AM, Zev Weiss <address@hidden> wrote:
> Hi,
>
> I noticed the print_offset() function in src/grep.c has been formatting its
> uintmax_t argument manually since sometime in the 1990s, when that was
> apparently necessary.  The C99 'j' printf length modifer for [u]intmax_t has
> been around for a while now though -- hopefully long enough that grep can
> safely use it instead of reimplementing it.

Hi Zev,
That is a compelling patch.
However, we have deliberately not used %j anywhere in gnulib-based
packages like coreutils, grep, gzip, diffutils because while it is
easy to build/use a new compiler on an old system, it is harder to
provide adequate run-time support for that.

On the plus side, I found that gettext has been using %j in one of its
tools for over two years:
http://git.savannah.gnu.org/cgit/gettext.git/commit/?id=b93e0b2a5b353699769696a09640ffde837e66d0

That is encouraging, and suggests it may finally be time to remove
these kludges everywhere and jump on the C99 train, finally.

Other opinions?

At worst, we could #ifdef this with the existing code and add an
autoconf run-test (they *are* frowned upon, with good reason, though)
to detect whether %ju actually works, and fall back to the existing
code when it doesn't.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]