This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [ob] Remove initializations of memset'd structure
> From: Elena Zannoni <ezannoni@redhat.com>
> Date: Tue, 17 Feb 2004 09:30:06 -0500
> > >
> > > - MSYMBOL_TYPE (m) = mst_unknown;
> >
> > This part of the patch seems to assume that mst_unknown has the value
> > zero. Should we have such assumptions in the code?
>
> Yes, in symtab.h mst_unknown is 0.
I know that, I looked it up in symtab.h. The question is, should the
code rely on the fact that zeroing out the struct causes the
MSYMBOL_TYPE member to become mst_unknown. Suppose we change the
enumeration some day, that would break the code.
So I think a comment is not enough, we should leave that line alone.
In general, it is my opinion that code should not assume anything
about the numerical values of enumerated types.