Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@mvista.com>
To: Andrew Cagney <ac131313@cygnus.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: RFA: ``set mips abi''
Date: Tue, 18 Jun 2002 15:34:00 -0000	[thread overview]
Message-ID: <20020618223408.GA5128@nevyn.them.org> (raw)
In-Reply-To: <3D0FB375.7060704@cygnus.com>

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


  reply	other threads:[~2002-06-18 22:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-13 11:51 Daniel Jacobowitz
2002-06-18 14:22 ` Andrew Cagney
2002-06-18 14:34   ` Daniel Jacobowitz
2002-06-18 15:26     ` Andrew Cagney
2002-06-18 15:34       ` Daniel Jacobowitz [this message]
2002-06-19  2:00         ` Andreas Schwab
2002-06-19  9:45 ` Daniel Jacobowitz
2002-06-19 11:43   ` Andrew Cagney

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=20020618223408.GA5128@nevyn.them.org \
    --to=drow@mvista.com \
    --cc=ac131313@cygnus.com \
    --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