This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


On 2019-08-23 3:47 p.m., Pedro Alves wrote:
> 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!

Yay, less work for me!  I'll run it through the buildbot and push it if it's all good.

Thanks,

Simon


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]