From: Daniel Jacobowitz <drow@false.org>
To: gdb-patches@sources.redhat.com
Subject: Re: [ob] Remove initializations of memset'd structure
Date: Tue, 17 Feb 2004 19:47:00 -0000 [thread overview]
Message-ID: <20040217194659.GA32474@nevyn.them.org> (raw)
In-Reply-To: <16434.27783.373959.570693@localhost.redhat.com>
On Tue, Feb 17, 2004 at 02:33:27PM -0500, Elena Zannoni wrote:
> Eli Zaretskii writes:
> > > 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.
> >
>
> Oh, I see. I misunderstood you.
>
> > 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.
>
> That's true. It would be safer to leave the line alone. I'll change
> it back. Also language_unknown is used similarly.
>
> I've committed this.
Thanks. The only downside is that this suggests the type of the
terminating symbol can ever be read without being in error, which is
incorrect; the minimal symbol table's end appears to be marked by
otherwise by SYMBOL_LINKAGE_NAME (msym) == NULL. Other minimal symbols
may have type mst_unknown.
Obviously this can't hurt though.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
next prev parent reply other threads:[~2004-02-17 19:47 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-02-16 21:15 Daniel Jacobowitz
2004-02-17 6:54 ` Eli Zaretskii
2004-02-17 14:34 ` Elena Zannoni
2004-02-17 19:12 ` Eli Zaretskii
2004-02-17 19:37 ` Elena Zannoni
2004-02-17 19:47 ` Daniel Jacobowitz [this message]
2004-02-17 20:28 ` Elena Zannoni
2004-02-17 20:44 ` Daniel Jacobowitz
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=20040217194659.GA32474@nevyn.them.org \
--to=drow@false.org \
--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