public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: Lancelot SIX <lsix@lancelotsix.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] [gdb] Add template functions assign_set/return_if_changed
Date: Thu, 8 Jun 2023 11:26:01 +0200	[thread overview]
Message-ID: <f20f084d-6cbf-6fcd-6c9b-af572db3908b@suse.de> (raw)
In-Reply-To: <341f5e87-4176-f331-7bba-418a2c4089d0@suse.de>

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<typename T>
>>> 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<int> (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


      reply	other threads:[~2023-06-08  9:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-23  7:19 Tom de Vries
2023-05-23  9:57 ` Lancelot SIX
2023-05-23 16:20   ` Tom de Vries
2023-06-08  9:26     ` Tom de Vries [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f20f084d-6cbf-6fcd-6c9b-af572db3908b@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    --cc=lsix@lancelotsix.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).