From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29549 invoked by alias); 17 Feb 2004 19:47:00 -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 29538 invoked from network); 17 Feb 2004 19:46:59 -0000 Received: from unknown (HELO nevyn.them.org) (66.93.172.17) by sources.redhat.com with SMTP; 17 Feb 2004 19:46:59 -0000 Received: from drow by nevyn.them.org with local (Exim 4.30 #1 (Debian)) id 1AtBBL-0008VI-AY for ; Tue, 17 Feb 2004 14:46:59 -0500 Date: Tue, 17 Feb 2004 19:47:00 -0000 From: Daniel Jacobowitz To: gdb-patches@sources.redhat.com Subject: Re: [ob] Remove initializations of memset'd structure Message-ID: <20040217194659.GA32474@nevyn.them.org> Mail-Followup-To: gdb-patches@sources.redhat.com References: <20040216211516.GA17055@nevyn.them.org> <16434.9582.574401.561988@localhost.redhat.com> <2914-Tue17Feb2004211147+0200-eliz@elta.co.il> <16434.27783.373959.570693@localhost.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <16434.27783.373959.570693@localhost.redhat.com> User-Agent: Mutt/1.5.1i X-SW-Source: 2004-02/txt/msg00480.txt.bz2 On Tue, Feb 17, 2004 at 02:33:27PM -0500, Elena Zannoni wrote: > Eli Zaretskii writes: > > > From: Elena Zannoni > > > 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