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: Tue, 23 May 2023 18:20:41 +0200	[thread overview]
Message-ID: <341f5e87-4176-f331-7bba-418a2c4089d0@suse.de> (raw)
In-Reply-To: <20230523095708.pegeoupqmirmdpoe@octopus>

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.

- Tom

>>
>> I've included it anyway, it may be the preferred choice in other cases.
>>
> 
> Best,
> Lancelot.


  reply	other threads:[~2023-05-23 16:20 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 [this message]
2023-06-08  9:26     ` Tom de Vries

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=341f5e87-4176-f331-7bba-418a2c4089d0@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).