Subject: bug#34951: [PATCH] grep: a kwset matcher not work in a grep matcher

From: [email-masked]
Date: Sun, 15 Dec 2019 01:14:24 -0700

OK. I skimmed the links.  But why not write the code to say what
we mean?  For example:

	#include <stdint.h>
	typedef int64_t dfa_size_t;

	extern void dfaparse (char const *, dfa_size_t, struct dfa *);
	extern void dfacomp (char const *, dfa_size_t, struct dfa *, bool);
			      bool allow_nl, dfa_size_t *count, bool *backref);

Using ptrdiff_t directly simply because it is defined to be the
largest signed integer remains ugly (and Paul has already moved to
a typedef in the implementation.)

int64_t is just as standard as ptrdiff_t and just as clear.

Thanks,

Arnold

Paul Eggert <[email-masked]> wrote:

> >> 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.