From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id ehqUEOrnbGSEDhIAWB0awg (envelope-from ) for ; Tue, 23 May 2023 12:20:58 -0400 Received: by simark.ca (Postfix, from userid 112) id 355031E11E; Tue, 23 May 2023 12:20:58 -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=uTae0Lb3; 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=-8.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A, 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 BD4791E0D6 for ; Tue, 23 May 2023 12:20:57 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E7A9A3858C78 for ; Tue, 23 May 2023 16:20:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E7A9A3858C78 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1684858856; bh=bKRStYzMYlakNMAPFH4w+St38Fa6BhysG3ES9ZsB44Y=; 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=uTae0Lb3wOu0oUzl0fmNqnLOD2ZXRAI4ofAx4lGWxGTQZ0ovT46p7YOu4x2AwCASz QsPwRAtPbYU/Zgop+rLNdxS0T0fF78YIB1NF7b+wrFJl1hR/KDR9iAuFK/DPjlkmyK Toz0N96TVp0TKc4K12P/QE4u/hZTgmclwwTwYDeI= Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by sourceware.org (Postfix) with ESMTPS id 927F63858D37 for ; Tue, 23 May 2023 16:20:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 927F63858D37 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-out1.suse.de (Postfix) with ESMTPS id 4A3BE22968; Tue, 23 May 2023 16:20:36 +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 355E513588; Tue, 23 May 2023 16:20:36 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 7ovTC9TnbGQsGwAAMHmgww (envelope-from ); Tue, 23 May 2023 16:20:36 +0000 Message-ID: <341f5e87-4176-f331-7bba-418a2c4089d0@suse.de> Date: Tue, 23 May 2023 18:20:41 +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> In-Reply-To: <20230523095708.pegeoupqmirmdpoe@octopus> 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 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. - Tom >> >> I've included it anyway, it may be the preferred choice in other cases. >> > > Best, > Lancelot.