bug-standards
[Top][All Lists]
Advanced

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

[bug-diffutils] bug#24311: bug#24311: bug#24311: [PATCH] maint: accommod


From: Eric Blake
Subject: [bug-diffutils] bug#24311: bug#24311: bug#24311: [PATCH] maint: accommodate LP64 systems
Date: Fri, 26 Aug 2016 14:46:29 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

[originally sent on bug-diffutils; but this deserves to be discussed on
bug-standards]

On 08/26/2016 01:42 PM, Paul Eggert wrote:
> On 08/26/2016 01:41 AM, Peter Rosin wrote:
>> It is wrong to assume that pointers fit in long int.
> 
> Not in GNU code.
> <https://www.gnu.org/prep/standards/html_node/CPU-Portability.html says
> that GNU programs should not make any effort to cater to the possibility
> that 'long' will be narrower than ptrdiff_t.
> 

Except that the mingw64 platform is indeed a modern platform where
pointers are 8 bytes but long is 4 bytes.  So maybe it is time to
propose a patch to the GNU Coding Standards that document the reality of
existing systems, and then start the process of auditing which programs
have been relying on the assumptions now rendered untrue by catering to
such a platform.

> Every POSIX platform is supposed to provide a compilation environment
> where 'long' is no wider than ptrdiff_t, so if you're using a POSIX
> platform you should be able to build diffutils without modifying its
> source code. See:
> 
> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/c99.html
> 

But GNU software often tries to be portable to more than just POSIX
platforms, and gnulib is already useful for catering to mingw64 where we
indeed have long narrower than intptr_t (I'm not sure off-hand whether
intptr_t and ptrdiff_t are the same size, or if ptrdiff_t is only 4 bytes).

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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