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