From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id Rj/TLQ+ObGRvwREAWB0awg (envelope-from ) for ; Tue, 23 May 2023 05:57:35 -0400 Received: by simark.ca (Postfix, from userid 112) id AB97D1E11E; Tue, 23 May 2023 05:57:35 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=aOyXmMX3; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 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 5E7BF1E111 for ; Tue, 23 May 2023 05:57:35 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B86C03858004 for ; Tue, 23 May 2023 09:57:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B86C03858004 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1684835854; bh=zjsUJCdvXP24GgQT9Y9jkXSYqKQYEk8sKi8NMw0W8gU=; h=Date:To:Cc:Subject:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=aOyXmMX3aTnhV/3vzhpNPSgBz27zAZDKtg3dnLvD/uSlk4NT+xo7rroxtjzejbp+F qRQQ5xArUOMmGRWxdfluI2AcOq50DzG/QKmRN09O9RxdwufoULA+s87Y3/Ef9J2Ry/ ZKbMYA+oYDMDqqyvfXhWSt5uS2WPsk6xZ1vkJczw= Received: from lndn.lancelotsix.com (vps-42846194.vps.ovh.net [IPv6:2001:41d0:801:2000::2400]) by sourceware.org (Postfix) with ESMTPS id 0AF053858415 for ; Tue, 23 May 2023 09:57:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0AF053858415 Received: from octopus (cust120-dsl54.idnet.net [212.69.54.120]) by lndn.lancelotsix.com (Postfix) with ESMTPSA id 949D889F61; Tue, 23 May 2023 09:57:13 +0000 (UTC) Date: Tue, 23 May 2023 10:57:08 +0100 To: Tom de Vries Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] [gdb] Add template functions assign_set/return_if_changed Message-ID: <20230523095708.pegeoupqmirmdpoe@octopus> References: <20230523071912.2197-1-tdevries@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230523071912.2197-1-tdevries@suse.de> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.11 (lndn.lancelotsix.com [0.0.0.0]); Tue, 23 May 2023 09:57:13 +0000 (UTC) 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: Lancelot SIX via Gdb-patches Reply-To: Lancelot SIX Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" Hi Tom, > I've initially considered using assign_return_if_changed for the rewrite: > ... > template > bool > assign_return_if_changed (T &lval, T val) > { > if (lval == val) > return false; > > lval = val; > changed = true; This line should be "return true" (only the commit comment is affected, the actual implementation is OK). > } > ... > but liked the resulting bitwise operator on the boolean a bit less: > ... > need_redraw |= assign_return_if_changed (tui_border_attrs, entry->value); > ... I think I like it a bit more (not by far though), but I guess that is just a personal preference ^_^. > > I've included it anyway, it may be the preferred choice in other cases. > Best, Lancelot.