From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-4.1 required=3.0 tests=AWL,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SPF_HELO_NONE shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 565D31F464 for ; Sun, 15 Dec 2019 08:14:50 +0000 (UTC) Received: from localhost ([::1]:36966 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1igP3A-0007eX-UL for normalperson@yhbt.net; Sun, 15 Dec 2019 03:14:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57588) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1igP37-0007eQ-F8 for bug-gnulib@gnu.org; Sun, 15 Dec 2019 03:14:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1igP36-0005l9-6e for bug-gnulib@gnu.org; Sun, 15 Dec 2019 03:14:45 -0500 Received: from freefriends.org ([96.88.95.60]:41316) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1igP35-0005jX-Ug for bug-gnulib@gnu.org; Sun, 15 Dec 2019 03:14:44 -0500 X-Envelope-From: arnold@skeeve.com Received: from freefriends.org (freefriends.org [96.88.95.60]) by freefriends.org (8.14.7/8.14.7) with ESMTP id xBF8EQW2005060 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 15 Dec 2019 01:14:27 -0700 Received: (from arnold@localhost) by freefriends.org (8.14.7/8.14.7/Submit) id xBF8EOXW005059; Sun, 15 Dec 2019 01:14:24 -0700 From: arnold@skeeve.com Message-Id: <201912150814.xBF8EOXW005059@freefriends.org> X-Authentication-Warning: frenzy.freefriends.org: arnold set sender to arnold@skeeve.com using -f Date: Sun, 15 Dec 2019 01:14:24 -0700 To: jim@meyering.net, eggert@cs.ucla.edu, arnold@skeeve.com Subject: Re: bug#34951: [PATCH] grep: a kwset matcher not work in a grep matcher References: <20190323080618.E6EB.27F6AC2D@kcn.ne.jp> <20190323114902.E6F6.27F6AC2D@kcn.ne.jp> <75091466-e105-c35c-fcd6-19ccca325914@cs.ucla.edu> <201912120731.xBC7V6gD031767@freefriends.org> <38194689-56ba-41f4-3810-50df1ff9019c@cs.ucla.edu> <201912130809.xBD89uUG021729@freefriends.org> <201912131208.xBDC8QLo032709@freefriends.org> <20db9cb5-da09-fe26-f7fc-884fc194daaa@cs.ucla.edu> In-Reply-To: <20db9cb5-da09-fe26-f7fc-884fc194daaa@cs.ucla.edu> User-Agent: Heirloom mailx 12.5 7/5/10 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 96.88.95.60 X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: 34951@debbugs.gnu.org, bug-gnulib@gnu.org, noritnk@kcn.ne.jp Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" OK. I skimmed the links. But why not write the code to say what we mean? For example: #include 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 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.