From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19197 invoked by alias); 19 Oct 2005 20:08:00 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 19171 invoked by uid 22791); 19 Oct 2005 20:07:56 -0000 Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Wed, 19 Oct 2005 20:07:56 +0000 Received: from drow by nevyn.them.org with local (Exim 4.54) id 1ESKE3-0004y3-Gc; Wed, 19 Oct 2005 16:07:51 -0400 Date: Wed, 19 Oct 2005 20:08:00 -0000 From: Daniel Jacobowitz To: Eli Zaretskii Cc: Andrew STUBBS , gdb-patches@sources.redhat.com Subject: Re: PATCH: Problem union comparision in TUI Message-ID: <20051019200751.GA19037@nevyn.them.org> Mail-Followup-To: Eli Zaretskii , Andrew STUBBS , gdb-patches@sources.redhat.com References: <4353BA69.1030401@st.com> <43561685.3010300@st.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.8i X-SW-Source: 2005-10/txt/msg00163.txt.bz2 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 > > 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. -- Daniel Jacobowitz CodeSourcery, LLC