public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Lancelot SIX <lsix@lancelotsix.com>
To: Tom de Vries <tdevries@suse.de>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] [gdb] Add template functions assign_set/return_if_changed
Date: Tue, 23 May 2023 10:57:08 +0100	[thread overview]
Message-ID: <20230523095708.pegeoupqmirmdpoe@octopus> (raw)
In-Reply-To: <20230523071912.2197-1-tdevries@suse.de>

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).

> }
> ...
> 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 ^_^.

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

Best,
Lancelot.

  reply	other threads:[~2023-05-23  9:57 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 [this message]
2023-05-23 16:20   ` Tom de Vries
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=20230523095708.pegeoupqmirmdpoe@octopus \
    --to=lsix@lancelotsix.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tdevries@suse.de \
    /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).