From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 38279 invoked by alias); 22 Aug 2019 00:44:44 -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 38265 invoked by uid 89); 22 Aug 2019 00:44:44 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 spammy=HDKIM-Filter:v2.11.0, H*F:D*ca, H*r:172.16.2 X-HELO: smtp.polymtl.ca Received: from smtp.polymtl.ca (HELO smtp.polymtl.ca) (132.207.4.11) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 22 Aug 2019 00:44:43 +0000 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id x7M0iQWA005702 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 21 Aug 2019 20:44:32 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca x7M0iQWA005702 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=polymtl.ca; s=default; t=1566434672; bh=M2BCiD/K0zfOMMRZ9H2lJjUn8b6XJrHwbLJly2l8UVI=; h=Subject:To:References:From:Date:In-Reply-To:From; b=YkYreufqxSx56w0H1tUpB9V5C7mXDQ+ck1eu/8RQneXpcA53ODqfmkVzsJrt0f3HP nbTtSmP+/CRSO+mzwLgTB96YPOsMU0qbUHMvFzKYmvWvhfA9qTNKinvvXpPZhgKX96 j8fqkfTvubu9a8DT/wviO8z1vWan21qC8z3C36i0= Received: from [172.16.2.176] (wsip-184-188-36-2.sd.sd.cox.net [184.188.36.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 09D7A1E636; Wed, 21 Aug 2019 20:44:25 -0400 (EDT) Subject: Re: [PATCH] Remove some variables in favor of using gdb::optional To: Pedro Alves , gdb-patches@sourceware.org References: <20190804201023.25628-1-simon.marchi@polymtl.ca> <9b1cdf6d-baae-3a5e-c2ea-fcdf124b7a1b@redhat.com> From: Simon Marchi Message-ID: <65a23d93-bf2e-de1a-9052-f6d75832c2a1@polymtl.ca> Date: Thu, 22 Aug 2019 00:44:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <9b1cdf6d-baae-3a5e-c2ea-fcdf124b7a1b@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2019-08/txt/msg00519.txt.bz2 On 2019-08-21 3:38 p.m., Pedro Alves wrote: > std::optional is evil. :-) > > E.g. it's very easy to write (or miss converting) > > if (is_static) > > and not realize that that is doing the wrong thing. > > https://www.boost.org/doc/libs/1_57_0/libs/optional/doc/html/boost_optional/tutorial/a_note_about_optional_bool_.html > > Not saying to change the code (*), but seeing it gives me the creeps, so I couldn't resist. :-) > > * - a yes/no/unknown tristate type a-la boost::tribool would be nice > to have, IMO. It could be used more clearly in these situations > and could supersede auto_boolean. > > Thanks, > Pedro Alves Oh, thanks for pointing out. I had never realized this but it makes sense. There should be a compiler warning about it! Or maybe it would belong to a linter. I'll look into adding a tristate bool and fixing it. Simon