Subject: Re: [bug-diffutils] bug#24311: bug#24311: [PATCH] maint: accommodate LP64 systems

From: Peter Rosin <[email-masked]>
Date: Sun, 28 Aug 2016 22:03:30 +0200

On 2016-08-28 00:07, Paul Eggert wrote:
> On further thought, I came up with a patch that should be portable without 
> overly complicating the code or hurting efficiency, so I installed it 
> (attached). Please give it a try on your platform.

So, I didn't expect that to work, because the C library in question is the
system msvcrt, which is compatible with the msvcrt for MSVC 6.0. That msvcrt
was released almost 30 years ago. I have a strong suspicion that all system
versions of the msvcrt library out there do not support %lld, even if you
limit the search to 64-bit Windows...

All in all, I was a bit surprised when it actually did work, and started
digging.

It seems that mingw-w64 includes overrides for the *printf functions, probably
because they are so unportable in msvcrt. Anyway, the overrides includes support
for the t length modifier, so a better patch might be a configure check to see
if %td works, with machinery to set printint/pI to ptrdiff_t/"t" if it does and
fall back to long int/"l" if it doesn't.

That would be correct even for weird -- but standards conformant -- systems
where even long long is too small for some obscure reason.

> I am still leery about changing the GNU coding standards, though. In general we 
> shouldn't ask developers to jump through these sorts of hoops for platforms so 
> far from the typical GNU environment.

My main beef with the GCS on this issue is that it suggests that maintainers
should not spend any time at all on this issue, as if that would be contrary
to some other goal. It would be much more palatable if it stated that
maintainers did not need to spend time on the issue if they didn't want to.

Cheers,
Peter