From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25412 invoked by alias); 11 Nov 2002 14:33:32 -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 25400 invoked from network); 11 Nov 2002 14:33:28 -0000 Received: from unknown (HELO crack.them.org) (65.125.64.184) by sources.redhat.com with SMTP; 11 Nov 2002 14:33:28 -0000 Received: from nevyn.them.org ([66.93.61.169] ident=mail) by crack.them.org with asmtp (Exim 3.12 #1 (Debian)) id 18BHVI-0007xr-00; Mon, 11 Nov 2002 10:33:37 -0600 Received: from drow by nevyn.them.org with local (Exim 3.36 #1 (Debian)) id 18BFdy-00071V-00; Mon, 11 Nov 2002 09:34:26 -0500 Date: Mon, 11 Nov 2002 06:33:00 -0000 From: Daniel Jacobowitz To: Felix Lee Cc: gdb-patches@sources.redhat.com Subject: Re: PATCH: Remove unnecessary zero-initializations Message-ID: <20021111143426.GA26740@nevyn.them.org> Mail-Followup-To: Felix Lee , gdb-patches@sources.redhat.com References: <20021111001910.GA17944@nevyn.them.org> <200211111048.gABAmXr01641@paper-wolf-solo.tigerfood.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200211111048.gABAmXr01641@paper-wolf-solo.tigerfood.org> User-Agent: Mutt/1.5.1i X-SW-Source: 2002-11/txt/msg00303.txt.bz2 On Mon, Nov 11, 2002 at 02:48:33AM -0800, Felix Lee wrote: > Daniel Jacobowitz : > > Currently, thirteen files which provide a target_ops explicitly initialize > > members they don't support to NULL. > > this is a style and readability issue. if every set of > initializations is complete and mentions all members, even > when "unnecessary", then it's easier to quickly check that > an implementation correctly matches the specification. a > statement like > foo.bar = 0; > indicates that the programmer was aware that foo.bar exists, > thought about it, and decided that 0 is a correct value. > > if the statement is missing, you have to spend time deciding > if the programmer omitted it accidentally or not. > > a different technique is to put a note in a comment instead > of as a statement: > // foo.bar can be 0 > but this is a pointless micro-optimization, it's an > optimization a compiler could be taught how to do, and you > lose the opportunity to have an automated tool check for you > that initializations are complete. Certainly it's a style issue. However, it's an awkward style issue and anyone implementing a target should be looking over the complete list of methods anyway. I stand by my patch... although perhaps not as "obvious" after two objections. -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer