From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: =?UTF-8?Q?Re=3a_master_31544bc=3a_Don=e2=80=99t_convert_pointer_to_?= =?UTF-8?Q?bool?= Date: Sat, 20 Mar 2021 10:01:20 -0700 Organization: UCLA Computer Science Department Message-ID: References: <20210320004804.9441.45535@vcs0.savannah.gnu.org> <20210320004805.B7BBF2101A@vcs0.savannah.gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32448"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 Cc: Emacs Development To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Mar 20 18:07:35 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lNf4Z-0008K7-90 for ged-emacs-devel@m.gmane-mx.org; Sat, 20 Mar 2021 18:07:35 +0100 Original-Received: from localhost ([::1]:58440 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lNf4Y-0002vE-6n for ged-emacs-devel@m.gmane-mx.org; Sat, 20 Mar 2021 13:07:34 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59266) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lNeye-0007F9-RM for Emacs-devel@gnu.org; Sat, 20 Mar 2021 13:01:29 -0400 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:57444) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lNeyc-0004r8-1T for Emacs-devel@gnu.org; Sat, 20 Mar 2021 13:01:28 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 984421600B7; Sat, 20 Mar 2021 10:01:22 -0700 (PDT) Original-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 Bqdxh-99q2ec; Sat, 20 Mar 2021 10:01:21 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 6476D1600D4; Sat, 20 Mar 2021 10:01:21 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-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 tDoU2UJ_MpvG; Sat, 20 Mar 2021 10:01:21 -0700 (PDT) Original-Received: from [192.168.1.9] (cpe-23-243-218-95.socal.res.rr.com [23.243.218.95]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id EAA961600B7; Sat, 20 Mar 2021 10:01:20 -0700 (PDT) In-Reply-To: Content-Language: en-US Received-SPF: pass client-ip=131.179.128.68; envelope-from=eggert@cs.ucla.edu; helo=zimbra.cs.ucla.edu X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:266656 Archived-At: On 3/20/21 7:05 AM, Stefan Monnier wrote: > Is it right to complain or is that a bug in that tool? > To my naive intuition, it looks wrong since conversion to bool is > standard practice when doing `if (ptr) ...`. 'bool b =3D ptr;' does not work in C89, and can be tricky in C++ as=20 witness the now-deprecated "safe bool idiom", so there is some style=20 caution here. Also, in my experience 'bool b =3D ptr;' is more likely to=20 be a typo. Since Emacs assumes C99-or-later this is just a style thing. Still, on=20 the whole it seems that the "!!" is a win as it is obvious, consumes=20 little room, and makes the unusual conversion clearer to the reader.