bug-diffutils
[Top][All Lists]
Advanced

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

[bug-diffutils] bug#24311: bug#24311: bug#24311: bug#24311: [PATCH] main


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

Andreas Gr├╝nbacher wrote:
FWIW, patch has the following typedef for line numbers:

  typedef off_t lin;

Maybe it would be time to switch to int64_t / uint64_t and PRId64 /
PRIu64 in diff as well as in patch?

No, as 'diff' puts all its data into memory (hence ptrdiff_t is appropriate), whereas 'patch' can operate on files that do not fit into memory (hence off_t is appropriate).

Generally speaking, portable code should be wary of using exact-sized types like int64_t. POSIX and the C standard don't even require int64_t, and there are a few (admittedly rare) implementations that lack int64_t. Even if int64_t was universally available, it would be better to use types like ptrdiff_t and off_t that reflect actual implementation limitations, as that better documents the code.





reply via email to

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