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

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


On 8/23/19 8:52 PM, Simon Marchi wrote:
> 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.

Sorry for the delayed nit, but the first time I didn't really pay attention
the the enumerator names you were using.  Reading back, I notice that you
used "dynamic".  I don't know what that means here?  Don't you mean
"external", as opposed to static?  Like, wouldn't this be more to the point?

  enum {
    symbol_linkage_unknown,
    symbol_linkage_static,
    symbol_linkage_extern,
  } symbol_linkage = symbol_linkage_unknown;

Thanks,
Pedro Alves



More information about the Gdb-patches mailing list