From: Mark Kettenis <mark.kettenis@xs4all.nl>
To: drow@false.org
Cc: eliz@gnu.org, andrew.stubbs@st.com, gdb-patches@sources.redhat.com
Subject: Re: PATCH: Problem union comparision in TUI
Date: Wed, 19 Oct 2005 20:22:00 -0000 [thread overview]
Message-ID: <200510192021.j9JKLM82007105@elgar.sibelius.xs4all.nl> (raw)
In-Reply-To: <20051019200751.GA19037@nevyn.them.org> (message from Daniel Jacobowitz on Wed, 19 Oct 2005 16:07:51 -0400)
> Date: Wed, 19 Oct 2005 16:07:51 -0400
> From: Daniel Jacobowitz <drow@false.org>
>
> On Wed, Oct 19, 2005 at 10:03:14PM +0200, Eli Zaretskii wrote:
> > > Date: Wed, 19 Oct 2005 10:48:53 +0100
> > > From: Andrew STUBBS <andrew.stubbs@st.com>
> > > Cc: gdb-patches@sources.redhat.com
> > >
> > > Is there any reason for using a union here?
> >
> > The reason is that the code should be clean and self-explanatory.
> > Using the same variable for storing two utterly different objects is
> > IMHO The Mother Of Unclean Code.
>
> Is an untagged union any clearer?
>
> We've already established (via the bug report) that some of the time,
> the code has no idea which one is in use when comparing them. They're
> used for relative line ordering within a particular window; if it's a
> source window, the lines are sorted by line number, and if it's a
> disassembly window, they're sorted by code address. So in both cases
> it's a "line number"; that's why I favor using a single variable for
> them, although I'm open to alternative suggestions.
But encoding line numbers in CORE_ADDR is probably a bad idea. In
many parts of GDB the signedness of the integer type matters. I've
found this out the hard way, when trying to fix some of the warnings
generated by GCC 4. I think there is no other option than going over
the code, analyzing what it does and analyzing it accordingly.
Mark
next prev parent reply other threads:[~2005-10-19 20:22 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-17 14:52 Andrew STUBBS
2005-10-17 15:02 ` Andrew STUBBS
2005-10-19 9:15 ` Eli Zaretskii
2005-10-19 9:51 ` Andrew STUBBS
2005-10-19 12:28 ` Daniel Jacobowitz
2005-10-19 16:22 ` Andrew STUBBS
2005-10-19 20:03 ` Eli Zaretskii
2005-10-19 20:08 ` Daniel Jacobowitz
2005-10-19 20:22 ` Mark Kettenis [this message]
2005-10-20 8:43 ` Eli Zaretskii
2005-10-20 10:18 ` Andrew STUBBS
2005-10-20 16:20 ` Andrew STUBBS
2005-10-20 17:56 ` Daniel Jacobowitz
2005-10-20 19:41 ` Eli Zaretskii
2005-10-21 14:55 ` Andrew STUBBS
2005-10-21 16:39 ` Daniel Jacobowitz
2005-10-21 22:03 ` Eli Zaretskii
2005-10-21 22:13 ` Eli Zaretskii
2005-10-24 10:28 ` Andrew STUBBS
2005-10-24 11:06 ` Eli Zaretskii
2005-10-24 12:56 ` Andrew STUBBS
2005-10-25 10:45 ` Eli Zaretskii
2005-11-01 16:24 ` Andrew STUBBS
2005-11-01 16:28 ` Daniel Jacobowitz
2005-11-01 17:43 ` Andrew STUBBS
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=200510192021.j9JKLM82007105@elgar.sibelius.xs4all.nl \
--to=mark.kettenis@xs4all.nl \
--cc=andrew.stubbs@st.com \
--cc=drow@false.org \
--cc=eliz@gnu.org \
--cc=gdb-patches@sources.redhat.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