This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: RFA: ``set mips abi''
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