From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id FOEqKbeegWScYyEAWB0awg (envelope-from ) for ; Thu, 08 Jun 2023 05:26:15 -0400 Received: by simark.ca (Postfix, from userid 112) id 9B0D91E124; Thu, 8 Jun 2023 05:26:15 -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=kUqR/S3s; 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=-9.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A, RCVD_IN_DNSWL_HI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (server2.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 A9E641E111 for ; Thu, 8 Jun 2023 05:26:14 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3DD0D3857735 for ; Thu, 8 Jun 2023 09:26:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3DD0D3857735 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1686216374; bh=LDZLTam04sEW4Zvu26S3JuvVnLO6oMV4tYDUJnxzN/I=; h=Date:Subject:To:Cc:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=kUqR/S3sYzrCXIBDRufea3qPnH1L2aXsJF0Wl5TPKMrC7gQPbW3hb51vx7DB2xdGM X2MHRL4qIrNQBEO4RXgsZP2FLk/kL+hLtuW4v3Qb0ABsBJ68hDMLWaMYq6cFQUrQ3X 5TgaLyAFlP/gAKNRanr3PFW4dWFRnDlzjkzot6Oo= Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id E03FA3858C62 for ; Thu, 8 Jun 2023 09:25:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E03FA3858C62 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 12FF01FDCC; Thu, 8 Jun 2023 09:25:54 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 005AD138E6; Thu, 8 Jun 2023 09:25:53 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 4zmnOqGegWRAbQAAMHmgww (envelope-from ); Thu, 08 Jun 2023 09:25:53 +0000 Message-ID: Date: Thu, 8 Jun 2023 11:26:01 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH] [gdb] Add template functions assign_set/return_if_changed Content-Language: en-US To: Lancelot SIX Cc: gdb-patches@sourceware.org References: <20230523071912.2197-1-tdevries@suse.de> <20230523095708.pegeoupqmirmdpoe@octopus> <341f5e87-4176-f331-7bba-418a2c4089d0@suse.de> In-Reply-To: <341f5e87-4176-f331-7bba-418a2c4089d0@suse.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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: Tom de Vries via Gdb-patches Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On 5/23/23 18:20, Tom de Vries via Gdb-patches wrote: > On 5/23/23 11:57, Lancelot SIX wrote: >> 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). >> > > Thanks for spotting that, I've updated my patch. > >>> } >>> ... >>> 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 ^_^. >> > > Thanks for that feedback, that's good to know, and I'm curious about > opinions of other as well. > I've submitted a v2 ( https://sourceware.org/pipermail/gdb-patches/2023-June/200148.html ): - now as patch series, also including a patch implementing the proposed rewrite in tui_update_variables - it uses assign_return_if_changed, I've changed my mind about preferring assign_set_if_changed - the commit message of the first patch has been updated to be more neutral - I've dropped the actual implementation from the commit message. Thanks, - Tom