From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 70831 invoked by alias); 23 Aug 2019 20:23:06 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 70822 invoked by uid 89); 23 Aug 2019 20:23:06 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=HX-Languages-Length:1883, pay X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 23 Aug 2019 20:23:05 +0000 Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 37D78C08C320 for ; Fri, 23 Aug 2019 20:23:04 +0000 (UTC) Received: by mail-wr1-f70.google.com with SMTP id k14so5332819wrv.2 for ; Fri, 23 Aug 2019 13:23:04 -0700 (PDT) Received: from ?IPv6:2001:8a0:f913:f700:4c97:6d52:2cea:997b? ([2001:8a0:f913:f700:4c97:6d52:2cea:997b]) by smtp.gmail.com with ESMTPSA id c201sm8267397wmd.33.2019.08.23.13.23.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 23 Aug 2019 13:23:01 -0700 (PDT) Subject: Re: [PATCH] Remove some variables in favor of using gdb::optional To: Simon Marchi , gdb-patches@sourceware.org References: <20190804201023.25628-1-simon.marchi@polymtl.ca> <9b1cdf6d-baae-3a5e-c2ea-fcdf124b7a1b@redhat.com> <65a23d93-bf2e-de1a-9052-f6d75832c2a1@polymtl.ca> <697c3e3d-4f75-4fb2-685b-a6fa59c7a2a3@polymtl.ca> <5d2e7548-1303-ba42-6d67-93ab37f6577d@redhat.com> <829ab63c-55b0-07bc-1517-0efe9aeecc95@polymtl.ca> <5ce0fc27-657c-a48a-8544-150a2a82b12f@redhat.com> <5994de6e-cb4b-2ec2-f6f9-1ee41da1827e@polymtl.ca> From: Pedro Alves Message-ID: Date: Fri, 23 Aug 2019 20:23:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <5994de6e-cb4b-2ec2-f6f9-1ee41da1827e@polymtl.ca> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2019-08/txt/msg00558.txt.bz2 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