From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1684858836; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bKRStYzMYlakNMAPFH4w+St38Fa6BhysG3ES9ZsB44Y=; b=Wg9YLzeEsZyiwZcbpFzeDvnGGdEUVnQ+UF/GHdTVzvYf5Y6TClCkBZNXFoPFYDGwUNMmUs IXbGULemgHocdNffjo39Wvalicyf62hFXanYOMclvCgepOOU2Iq3+O5UFYVnVnSea3M2vn JfQJTLGhwvHXPgIuu5uQh4tlFW4Mp0k= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1684858836; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bKRStYzMYlakNMAPFH4w+St38Fa6BhysG3ES9ZsB44Y=; b=66C6vcQ6u+7MDRVDjS5nNTTU7EHMDjcs6/7OYzXnND9QTiVZOPcGV/sfTG5KOmFHQoohk4 2BA8i03AyyuEJoDQ== 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> From: Tom de Vries In-Reply-To: <20230523095708.pegeoupqmirmdpoe@octopus> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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.