From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 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-out2.suse.de (Postfix) with ESMTPS id 12FF01FDCC; Thu, 8 Jun 2023 09:25:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1686216354; 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=LDZLTam04sEW4Zvu26S3JuvVnLO6oMV4tYDUJnxzN/I=; b=b8Wreg4PdFqwpN4cDIqasC8oVhyCJXzdyJeuMaM8SnqqvvSWtep+gVTCF/Hr4vRjIyUoNQ nmHdsPWzTTmTScP+yxDpMkYw6tMrlXEGnmkyVgAp4qaxInm0CBA3f9SGsvA0QqIczxmJbV rPgj8vcme7Gbx3zGxN25rSTGubzYEO4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1686216354; 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=LDZLTam04sEW4Zvu26S3JuvVnLO6oMV4tYDUJnxzN/I=; b=Tnc2bHv931hTQ4Hf1bOBwp4aDUi8mEYkrmlcyLeB83Tv6iBxC20PkU5kHZK/gtgA616xEl /4C+//gMhq0aulCQ== 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> From: Tom de Vries In-Reply-To: <341f5e87-4176-f331-7bba-418a2c4089d0@suse.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00,BODY_8BITS,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 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