bug-diffutils
[Top][All Lists]
Advanced

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

[bug-diffutils] bug#24311: bug#24311: [PATCH] maint: accommodate LP64 sy


From: Paul Eggert
Subject: [bug-diffutils] bug#24311: bug#24311: [PATCH] maint: accommodate LP64 systems
Date: Fri, 26 Aug 2016 11:42:42 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0

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.

(It should be safe to convert ptrdiff_t to long in an LP64 system, so I assume you meant to write "LLP64" in the Subject: line. Also, the values in questions are offsets, not pointers, so I assume you meant to write "pointer differences" not "pointers" in the above-quoted sentence.)

A problem with the proposed patch is that it uses PRIdPTR, and thus won't work on platforms with older C libraries that lack support for PRIdPTR. Although this can be worked around with some effort, as a general rule we prefer to avoid the effort.

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






reply via email to

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