From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8550 invoked by alias); 13 Nov 2002 19:38:37 -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 8543 invoked from network); 13 Nov 2002 19:38:37 -0000 Received: from unknown (HELO mail-out1.apple.com) (17.254.0.52) by sources.redhat.com with SMTP; 13 Nov 2002 19:38:37 -0000 Received: from mailgate1.apple.com (A17-128-100-225.apple.com [17.128.100.225]) by mail-out1.apple.com (8.11.3/8.11.3) with ESMTP id gADJcZw20888 for ; Wed, 13 Nov 2002 11:38:36 -0800 (PST) Received: from scv1.apple.com (scv1.apple.com) by mailgate1.apple.com (Content Technologies SMTPRS 4.2.5) with ESMTP id ; Wed, 13 Nov 2002 11:38:17 -0800 Received: from apple.com (il0102a-dhcp19.apple.com [17.201.27.147]) by scv1.apple.com (8.11.3/8.11.3) with ESMTP id gADJcYx23090; Wed, 13 Nov 2002 11:38:34 -0800 (PST) Message-ID: <3DD2A9EC.3010201@apple.com> Date: Wed, 13 Nov 2002 11:38:00 -0000 From: Stan Shebs User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US; rv:1.1) Gecko/20020826 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Michael Snyder CC: Felix Lee , gdb-patches@sources.redhat.com Subject: Re: PATCH: Remove unnecessary zero-initializations References: <200211112116.gABLGeB03251@paper-wolf-solo.tigerfood.org> <3DD2A230.5A2935EC@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2002-11/txt/msg00388.txt.bz2 Michael Snyder wrote: >Felix Lee wrote: > >>Daniel Jacobowitz : >> >>>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. >>> >>Of course. It's not about writing the target in the first >>place, it's about reading it and maintaining it later. Say, >>a year from now, someone adds a new method but doesn't spend >>all the effort necessary to make all N targets work >>correctly with the change, which is reasonable since it's >>not sensible to insist that everyone be familiar with the >>issues of all N targets before doing any work. >> >>Absence of an initializer is a simple indication that >>someone should look at it and make sure it's ok. >> > >No. New target methods need to be optional, else someone >will be required to go back and implement them for all old targets. >The fact that they don't need to be initialized to zero is intentional, >so that a new method does not require any modification to old targets. >If there is no initialization, and indeed no mention of the new >method at all in an old target module, you can safely conclude >that the module doesn't implement the method. > That's right. The goal was to make it follow an object-oriented style, where when you instantiate something, you only fill in the elements that don't have a default value. While there's something to be said for the opposite style, on the theory that it means you have to consider whether to implement each method, it breaks down when the superclass (aka target vector struct) changes, because you then have to go and modify all the instances, including those for targets that you don't have access to (and *nobody* has h/w for all the targets supported by GDB!), so you're in the undesirable situation of modifying code that you can't test. Stan >