[PATCH] Remove some variables in favor of using gdb::optional

Pedro Alves palves@redhat.com
Fri Aug 23 19:47:00 GMT 2019

On 8/23/19 8:33 PM, Simon Marchi wrote:
> On 2019-08-23 11:35 a.m., Pedro Alves wrote:

>> Would you like to run with this?
> So I wasn't sure about what the third state should be.  I think it depends on
> the particular context.  In different contexts, it could mean "unknown", "unspecified",
> "auto", "don't care", etc.  There's no one-size word that fits all case, so I don't really
> like the idea of having just one word and have it represent poorly what we actually mean.
> That lead me to think, if we want to represent three states and if the states are
> specific to each use case, why not just define an enum and be explicit about it?

That's a very good point actually.  I agree and I'm convinced.

Let's shelve the tribool idea until/if we find a better use for it.

> A bit like why I prefer defining an explicit type with two fields rather than using
> std::pair: the "first" and "second" members are not very descriptive.

Right, agreed, the fact that std::map/std::unordered_map searching returns pairs
is one of those things I hate the most about C++.

> Here's a patch that does that.  What do you think?

I think I like it!

Pedro Alves

More information about the Gdb-patches mailing list