[PATCH] Remove some variables in favor of using gdb::optional
Simon Marchi
simon.marchi@polymtl.ca
Thu Aug 22 00:44:00 GMT 2019
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
More information about the Gdb-patches
mailing list