From: Simon Marchi <simon.marchi@polymtl.ca>
To: Pedro Alves <palves@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] Remove some variables in favor of using gdb::optional
Date: Thu, 22 Aug 2019 00:44:00 -0000 [thread overview]
Message-ID: <65a23d93-bf2e-de1a-9052-f6d75832c2a1@polymtl.ca> (raw)
In-Reply-To: <9b1cdf6d-baae-3a5e-c2ea-fcdf124b7a1b@redhat.com>
On 2019-08-21 3:38 p.m., Pedro Alves wrote:
> std::optional<bool> is evil. :-)
>
> E.g. it's very easy to write (or miss converting)
>
> if (is_static)
>
> and not realize that that is doing the wrong thing.
>
> https://www.boost.org/doc/libs/1_57_0/libs/optional/doc/html/boost_optional/tutorial/a_note_about_optional_bool_.html
>
> Not saying to change the code (*), but seeing it gives me the creeps, so I couldn't resist. :-)
>
> * - a yes/no/unknown tristate type a-la boost::tribool would be nice
> to have, IMO. It could be used more clearly in these situations
> and could supersede auto_boolean.
>
> Thanks,
> Pedro Alves
Oh, thanks for pointing out. I had never realized this but it makes sense. There should be a compiler
warning about it! Or maybe it would belong to a linter.
I'll look into adding a tristate bool and fixing it.
Simon
next prev parent reply other threads:[~2019-08-22 0:44 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-04 20:10 Simon Marchi
2019-08-04 21:21 ` Tom Tromey
2019-08-05 2:39 ` Simon Marchi
2019-08-05 4:09 ` Tom Tromey
2019-08-21 19:38 ` Pedro Alves
2019-08-22 0:44 ` Simon Marchi [this message]
2019-08-22 23:36 ` Simon Marchi
2019-08-23 15:35 ` Pedro Alves
2019-08-23 19:33 ` Simon Marchi
2019-08-23 19:47 ` Pedro Alves
2019-08-23 19:53 ` Simon Marchi
2019-08-23 20:23 ` Pedro Alves
2019-08-23 22:24 ` Simon Marchi
2019-08-23 22:25 ` Simon Marchi
2019-08-24 11:23 ` Ruslan Kabatsayev
2019-08-24 23:56 ` Simon Marchi
2019-08-25 22:35 ` Simon Marchi
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=65a23d93-bf2e-de1a-9052-f6d75832c2a1@polymtl.ca \
--to=simon.marchi@polymtl.ca \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.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