From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id zrxFONuFFmFFGAAAWB0awg (envelope-from ) for ; Fri, 13 Aug 2021 10:46:51 -0400 Received: by simark.ca (Postfix, from userid 112) id D5B401EDFB; Fri, 13 Aug 2021 10:46:51 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id BA0451E4A3 for ; Fri, 13 Aug 2021 10:46:50 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 202B63969C11 for ; Fri, 13 Aug 2021 14:46:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 202B63969C11 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1628866010; bh=S0YTQems5EMXMQiST+zyXQ2O5NMAPdyCrYEskddx3ks=; h=Subject:In-Reply-To:Date:References:To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=gjGtBVo+TGMk3Ykkw5FHpEMSIccrWJNSAsLFgKo76J2OiTl2cPwFiXJnlO/VtR91J clT7D0rW4EfUFOD5ksZe27gXHjeDqpvk7ZokFPrfQ0xAl8yB+vmniBYon6YYfmi6r5 hP8pJVt1vMEdIvdoxrslok4q1HKs4vHYCcGhCQJA= Received: from resqmta-po-06v.sys.comcast.net (resqmta-po-06v.sys.comcast.net [IPv6:2001:558:fe16:19:96:114:154:165]) by sourceware.org (Postfix) with ESMTPS id 8F6793858023 for ; Fri, 13 Aug 2021 14:46:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8F6793858023 Received: from resomta-po-18v.sys.comcast.net ([96.114.154.242]) by resqmta-po-06v.sys.comcast.net with ESMTP id EYHPm00vvskgGEYS5m6RqK; Fri, 13 Aug 2021 14:46:29 +0000 Received: from smtpclient.apple ([73.60.223.101]) by resomta-po-18v.sys.comcast.net with ESMTPSA id EYRxmm5XzNeRREYRym2b7e; Fri, 13 Aug 2021 14:46:24 +0000 X-Xfinity-VAAS: gggruggvucftvghtrhhoucdtuddrgedvtddrkeehgdekvdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucevohhmtggrshhtqdftvghsihdpqfgfvfdppffquffrtefokffrnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpegtggfuhfgjfffgkfhfvffosehtqhhmtdhhtddvnecuhfhrohhmpefrrghulhcumfhonhhinhhguceophgruhhlkhhonhhinhhgsegtohhmtggrshhtrdhnvghtqeenucggtffrrghtthgvrhhnpedvtdevjeeuhefhiedvteffjeeuffehkefgudeutdevffefkeeijeelfeevuefhgeenucfkphepjeefrdeitddrvddvfedruddtudenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhephhgvlhhopehsmhhtphgtlhhivghnthdrrghpphhlvgdpihhnvghtpeejfedriedtrddvvdefrddutddupdhmrghilhhfrhhomhepphgruhhlkhhonhhinhhgsegtohhmtggrshhtrdhnvghtpdhrtghpthhtohepshhimhhonhdrmhgrrhgthhhisehpohhlhihmthhlrdgtrgdprhgtphhtthhopehguggsqdhprghttghhvghssehsohhurhgtvgifrghrvgdrohhrgh X-Xfinity-VMeta: sc=-100.00;st=legit Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: Re: Coding standards proposal, usage of "this" In-Reply-To: Date: Fri, 13 Aug 2021 10:46:21 -0400 Content-Transfer-Encoding: quoted-printable Message-Id: <01BE4175-EDDE-4B84-9FE8-B0C748BE0808@comcast.net> References: To: Simon Marchi X-Mailer: Apple Mail (2.3654.120.0.1.13) X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Paul Koning via Gdb-patches Reply-To: Paul Koning Cc: "gdb-patches@sourceware.org" Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" > On Aug 13, 2021, at 10:26 AM, Simon Marchi via Gdb-patches = wrote: >=20 > Hi all, >=20 > Here's something I had in mind for a while. We don't consistently use > `this` when referring to fields or methods of the current object. I > never now if I should use it or not, or point it out in review. I > therefore propose these rules so that we have something to refer to. >=20 > - Use `this` when referring to a data member that is not prefixed by > `m_`. Rationale: without `this`, it's not clear that you are > referring to a member of the current class, versus a local or global > variable. > - Don't use `this` when referring to a data member that is prefixed by > `m_`. Rationale: the prefix already makes it clear that you are > referring to a member of the current class, so adding `this` would > just add noise. > - Use `this` when referring to a method of the current class. > Rationale: without `this, it's not clear that you are referring to a > method of the current class, versus a free function. >=20 > ... >=20 > Any comments? My intention would be to add this to the coding = standards > on the wiki. This roughly amounts to turning C++ coding conventions into those of = Python. While I like the Python ones, it seems odd to force C++ style = into something clearly not envisioned by its basic structure. The fact that C++ requires "this" in a few obscure cases is due to messy = add-ons like templates. I don't see that as a reason to put "this" = everywhere else. =20 paul