From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) by sourceware.org (Postfix) with ESMTPS id EC3A0385780D for ; Fri, 8 Apr 2022 17:40:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EC3A0385780D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f52.google.com with SMTP id h16so6019730wmd.0 for ; Fri, 08 Apr 2022 10:40:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=NA0U6bveyBNGwD/oKUvnshNjR+DPmtYbdrTGcb9XNZ4=; b=nowqMSyJGCWngA1fHBv4kt4Xzdqm4TZbnQoVLXHF1VoM+saUQI6Hpfe02jZfY8IbQU lGafKUFCH1VvefdxawCj5Je9/ec0irKiV5jsDD6p2mUy1A1CecdGOrEcP28SiJbby2v1 FwzBftKwX382L6aUT8gsbWFJ9upZMaprU4l1GiZDyRpYdixFT+SKHElzy0ACv7ApfITj Rd9tpORJHNCijeWi+fvUTP3Ru3ZXQkQk3gvKfKZPVHOQI+H3xL2q3wbGSKG4Rtmctva9 +KJzZEpgs7r7eX1kIYb3e+lqj4V6RQPFfZqvSFnDBFFJT0lvEb/D/VQMvsnGJ5xuN2U/ FKiA== X-Gm-Message-State: AOAM532ouvEHfreEiVL77jrGdVq40bAA8XQ95rVAI/eVMEF3mZVMPemh +I24pHlDvj5FXH3S9fTzo48= X-Google-Smtp-Source: ABdhPJzQRQNOHk0f/XXQ0ciIFt/PB3SjYP2o75Ee53P02yodYaiIimND63lmk7EP1JnPQXR600/JOw== X-Received: by 2002:a05:600c:22c3:b0:38e:6c5c:b2f7 with SMTP id 3-20020a05600c22c300b0038e6c5cb2f7mr17609082wmg.11.1649439613755; Fri, 08 Apr 2022 10:40:13 -0700 (PDT) Received: from ?IPV6:2001:8a0:f924:2600:209d:85e2:409e:8726? ([2001:8a0:f924:2600:209d:85e2:409e:8726]) by smtp.gmail.com with ESMTPSA id a18-20020a05600c349200b0038ca453a887sm11069161wmq.19.2022.04.08.10.40.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 08 Apr 2022 10:40:11 -0700 (PDT) Message-ID: <40433237-0287-ac3f-b077-0f2e36f1ce24@palves.net> Date: Fri, 8 Apr 2022 18:40:08 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH 1/4] Switch order of comparison in some spots Content-Language: en-US To: Tom Tromey , gdb-patches@sourceware.org References: <20220407231905.541589-1-tom@tromey.com> <20220407231905.541589-2-tom@tromey.com> From: Pedro Alves In-Reply-To: <20220407231905.541589-2-tom@tromey.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Apr 2022 17:40:16 -0000 On 2022-04-08 00:19, Tom Tromey wrote: > In the smart wrapper for "frame_info *", I've implemented the > comparison operators as members. This means that they are > order-dependent -- "x == NULL" works, but "NULL == x" does not. > > I don't consider this a big deal, since the former is the normal > spelling anyway. And, when building GDB, it only affected three > spots, fixed here. > > It would be possible to reimplement these operators outside the class, > to allow both orders, if someone feels this is important. Offhand, I do, but just because feels weirdly unnecessary to not make it completely correct. I don't think implementing the operators outside a class should be any harder than as methods. If the problem is access to internal details, you can declare the global operator== as a friend: friend bool operator==(const mytype&, const mytype&);