From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21773 invoked by alias); 28 Mar 2018 12:30:36 -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 127907 invoked by uid 89); 28 Mar 2018 12:30:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 28 Mar 2018 12:30:20 +0000 Received: from [10.0.0.11] (unknown [192.222.164.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 2B0551E4B2; Wed, 28 Mar 2018 08:30:03 -0400 (EDT) Subject: Re: [RFA 1/2] Make line tables independent of progspace To: Tom Tromey , Simon Marchi Cc: gdb-patches@sourceware.org References: <20180321171809.13115-1-tom@tromey.com> <20180321171809.13115-2-tom@tromey.com> <87zi2uw3uc.fsf@tromey.com> <87vadiw24a.fsf@tromey.com> <87r2o4x0kw.fsf@tromey.com> From: Simon Marchi Message-ID: Date: Wed, 28 Mar 2018 12:30:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <87r2o4x0kw.fsf@tromey.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2018-03/txt/msg00585.txt.bz2 On 2018-03-28 12:53 AM, Tom Tromey wrote: > Simon> Both branches return -1 here. > > Ugh, sorry. This got introduced during the changes to use member > functions. > > Simon> I don't mind the "left - right", I see that often. Especially when you > Simon> want to sort by multiple fields, it's short and clear (IMO) to do > > In this particular case I think it is a bit weird, because the addresses > are unsigned, so this is relying on the implicit cast to make the value > negative. But also, because the addresses are CORE_ADDR and the return > type is int, it seems like underflow is possible as well (in theory, I > suppose I wouldn't expect it in practice). > > So, I thought rather than being tricky here, it was more obviously > correct to just write the longer form. Which would be true if it didn't > introduce bugs. Ah, I thought that subtracting two unsigned yielded a signed result, like subtracting two pointers gives a ptrdiff_t result (which is signed). But that doesn't seem true. So I'm fine with changing it then.