I see that Paul has made the change to the API over my objections.
I made the change while responding to Bruno's objections, but before
seeing yours. Ooops. Sorry about that. However, I hope the followup
emails have addressed your comments, at least to some extent.
Paul, can you point to a link that lists the benefits/tradeoffs? If I
had such a link handy, I would have provided it here.
Avoiding unsigned types for indexes and sizes seems to be a growing
movement. Admittedly there are arguments for unsigned, but these
arguments are getting weaker with time. Here are a couple of links, the
first for C and the second for C++:
https://www.gnu.org/software/emacs/manual/html_node/elisp/C-Integer-Types.html
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1428r0.pdf
As for ssize_t vs ptrdiff_t: ssize_t is less central to the C language
(ptrdiff_t is in the C standard but ssize_t is not). And ssize_t is less
convenient: for example, there's no simple, portable way to printf an
ssize_t value, as there is with "%td" and ptrdiff_t. So there are
technical reasons for preferring ptrdiff_t to ssize_t for this sort of
thing (even though "ssize_t" is a shorter and better name). Thich is why
Emacs, other parts of Gnulib, and other Gnu applications have used
ptrdiff_t instead of ssize_t for this sort of thing.