From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29149 invoked by alias); 18 Jun 2002 22:34:24 -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 29092 invoked from network); 18 Jun 2002 22:34:13 -0000 Received: from unknown (HELO crack.them.org) (65.125.64.184) by sources.redhat.com with SMTP; 18 Jun 2002 22:34:13 -0000 Received: from 01-023.118.popsite.net ([66.19.120.23] helo=nevyn.them.org) by crack.them.org with asmtp (Exim 3.12 #1 (Debian)) id 17KRYA-0003qX-00; Tue, 18 Jun 2002 17:34:10 -0500 Received: from drow by nevyn.them.org with local (Exim 3.35 #1 (Debian)) id 17KRY8-0001Lt-00; Tue, 18 Jun 2002 18:34:08 -0400 Date: Tue, 18 Jun 2002 15:34:00 -0000 From: Daniel Jacobowitz To: Andrew Cagney Cc: gdb-patches@sources.redhat.com Subject: Re: RFA: ``set mips abi'' Message-ID: <20020618223408.GA5128@nevyn.them.org> Mail-Followup-To: Andrew Cagney , gdb-patches@sources.redhat.com References: <20020613185151.GA352@nevyn.them.org> <3D0FA494.3040706@cygnus.com> <20020618213416.GA2881@nevyn.them.org> <3D0FB375.7060704@cygnus.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3D0FB375.7060704@cygnus.com> User-Agent: Mutt/1.5.1i X-SW-Source: 2002-06/txt/msg00349.txt.bz2 On Tue, Jun 18, 2002 at 06:25:57PM -0400, Andrew Cagney wrote: > > > >If we didn't already have and need the enum all over that file, I'd > >agree with you. I don't see a point in all the extra globals. But > >hey, I don't mind. > > Yes, I noticed that. I was thinking of just changing the global_...() > function to be: > > if (mips_abi == mips_abi_o32) > return MIPS_ABI_O32; > else if (...) > .. > else > internal error() > > so that the rest didn't need to be changed. It is how it has been done > in the past. Then you've got a function and an enum to keep in sync. That's even more complicated than an array and an enum, in my opinion... not an advantage at all. I guess the internal_error will kick you if you do that... I'll clean this up before I commit it. > >>(Having an enum mechanism that bound a number to a name would be nice). > > >You can do it very easily with designated initializers, but they are > >not adequately portable. You can do it very easily building the array > >at runtime but why bother? Keeping two lists in sync is not the most > >complicated thing in the world. > > (what's a designated initializer?) I think I'm mixing terms here; I'm thinking of two language extensions in GCC and c99. The pertinent one is: void *array[] = { [1] NULL, [2] some_void_ptr, [3] NULL, }; I think you can use enum values as the tags but I'm not quite sure. -- Daniel Jacobowitz Carnegie Mellon University MontaVista Software Debian GNU/Linux Developer