From: Simon Marchi <simark@simark.ca>
To: Tom Tromey <tom@tromey.com>, Simon Marchi <simon.marchi@ericsson.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA 1/2] Make line tables independent of progspace
Date: Wed, 28 Mar 2018 12:30:00 -0000 [thread overview]
Message-ID: <c7331249-fa43-92c8-3982-3e00cc8cb13c@simark.ca> (raw)
In-Reply-To: <87r2o4x0kw.fsf@tromey.com>
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.
next prev parent reply other threads:[~2018-03-28 12:30 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-21 17:18 [RFA 0/2] " Tom Tromey
2018-03-21 17:18 ` [RFA 1/2] " Tom Tromey
2018-03-24 3:40 ` Simon Marchi
2018-03-27 4:16 ` Tom Tromey
2018-03-27 4:53 ` Tom Tromey
2018-03-27 20:22 ` Simon Marchi
2018-03-28 4:53 ` Tom Tromey
2018-03-28 12:30 ` Simon Marchi [this message]
2018-03-28 3:34 ` Simon Marchi
2018-03-28 5:02 ` Tom Tromey
2018-03-28 12:32 ` Simon Marchi
2018-03-28 19:33 ` Maciej W. Rozycki
2018-03-29 15:04 ` Simon Marchi
2018-03-29 21:07 ` Maciej W. Rozycki
2018-04-26 21:30 ` Tom Tromey
2018-05-03 23:17 ` Maciej W. Rozycki
2018-05-14 23:54 ` Maciej W. Rozycki
2018-03-21 17:18 ` [RFA 2/2] Constify the line table Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c7331249-fa43-92c8-3982-3e00cc8cb13c@simark.ca \
--to=simark@simark.ca \
--cc=gdb-patches@sourceware.org \
--cc=simon.marchi@ericsson.com \
--cc=tom@tromey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox