From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 120077 invoked by alias); 23 Aug 2019 19:47:07 -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 120061 invoked by uid 89); 23 Aug 2019 19:47: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=states 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 19:47:05 +0000 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (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 506E4368FF for ; Fri, 23 Aug 2019 19:47:04 +0000 (UTC) Received: by mail-wm1-f69.google.com with SMTP id f14so3264389wmh.7 for ; Fri, 23 Aug 2019 12:47: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 91sm11311464wrp.3.2019.08.23.12.47.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 23 Aug 2019 12:47:02 -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> From: Pedro Alves Message-ID: <5ce0fc27-657c-a48a-8544-150a2a82b12f@redhat.com> Date: Fri, 23 Aug 2019 19:47: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: <829ab63c-55b0-07bc-1517-0efe9aeecc95@polymtl.ca> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2019-08/txt/msg00556.txt.bz2 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! Thanks, Pedro Alves