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=-3.9 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS 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 0B8B81F463 for ; Sat, 14 Dec 2019 03:20:03 +0000 (UTC) Received: from localhost ([::1]:55782 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifxyL-00062P-Fj for normalperson@yhbt.net; Fri, 13 Dec 2019 22:20:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39272) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifxyE-000623-50 for bug-gnulib@gnu.org; Fri, 13 Dec 2019 22:19:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ifxyC-00016r-JP for bug-gnulib@gnu.org; Fri, 13 Dec 2019 22:19:53 -0500 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:52002) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ifxyC-00012k-D2 for bug-gnulib@gnu.org; Fri, 13 Dec 2019 22:19:52 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 6A2F0160240; Fri, 13 Dec 2019 19:19:50 -0800 (PST) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id ILbsIvrX3v6u; Fri, 13 Dec 2019 19:19:49 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id C19B7160500; Fri, 13 Dec 2019 19:19:49 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id LV0S1yoVonsf; Fri, 13 Dec 2019 19:19:49 -0800 (PST) Received: from [192.168.1.9] (cpe-23-242-74-103.socal.res.rr.com [23.242.74.103]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 9BD01160240; Fri, 13 Dec 2019 19:19:49 -0800 (PST) Subject: Re: intptr_t vs. uintptr_t To: Bruno Haible References: <20190323080618.E6EB.27F6AC2D@kcn.ne.jp> <20db9cb5-da09-fe26-f7fc-884fc194daaa@cs.ucla.edu> <2169340.l2UmpkpDhn@omega> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: <5120e6e1-1116-dc47-292f-d721014e3aea@cs.ucla.edu> Date: Fri, 13 Dec 2019 19:19:46 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.1 MIME-Version: 1.0 In-Reply-To: <2169340.l2UmpkpDhn@omega> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 131.179.128.68 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: bug-gnulib@gnu.org Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" On 12/13/19 6:35 PM, Bruno Haible wrote: > "Prefer intptr_t for internal representations of pointers" > > I disagree with this advice. uintptr_t ought to be used for representing the > address of a pointer. It depends on the application. For example, with two char * pointers P and Q into an array, it can be helpful that P - Q yields the same integer as ((intptr_t) P - (intptr_t) Q), assuming the usual representation. That's not true for uintptr_t. In practice, Emacs uses uintptr_t quite a bit for things like hashes and tags; but it uses intptr_t a bit more, so the advice seems reasonable for Emacs.