From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16445 invoked by alias); 11 Jan 2013 18:44:50 -0000 Received: (qmail 16385 invoked by uid 22791); 11 Jan 2013 18:44:48 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_HOSTKARMA_NO,TW_BJ X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 11 Jan 2013 18:44:35 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 3FAC12E651; Fri, 11 Jan 2013 13:44:34 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id UbR9h7KL17cb; Fri, 11 Jan 2013 13:44:34 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id B2A6F2E401; Fri, 11 Jan 2013 13:44:33 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id A6615C23AD; Fri, 11 Jan 2013 22:44:22 +0400 (RET) Date: Fri, 11 Jan 2013 18:44:00 -0000 From: Joel Brobecker To: Pedro Alves Cc: Yao Qi , gdb-patches@sourceware.org Subject: Re: [PATCH] Don't check PST is NULL in read_symtab Message-ID: <20130111184422.GO6143@adacore.com> References: <1357869440-23451-1-git-send-email-yao@codesourcery.com> <20130111045233.GK6143@adacore.com> <50F025B5.2060203@codesourcery.com> <20130111150537.GM6143@adacore.com> <50F05388.2090408@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <50F05388.2090408@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2013-01/txt/msg00239.txt.bz2 > FWIW, I agree with both of you. I agree with assertion's > roles. But I also agree with Yao that for functions that implement > a class-like interface and take a "this" pointer, there's no need > to sprinkle the codebase with "gdb_assert (self != NULL)" checks. > BUT (!), when reading one of those functions, it's a bit more obvious > and self-describing that the function takes a "this"-style pointer > when the parameter is actually called "self", and / or at least is > the first parameter in the function's signature. Like: I agree with everything said above. Just to be extra clear, in case I appeared to be insisting - I was just thinking about the assert, not requesting it. > static void > dbx_psymtab_to_symtab_1 (struct objfile *objfile, struct partial_symtab *pst) > { > > static void > dbx_psymtab_to_symtab_1 (struct partial_symtab *pst, struct objfile *objfile) > { > > static void > dbx_psymtab_to_symtab_1 (struct partial_symtab *self, struct objfile *objfile) > { I like "self" quite a bit, except that it's a little bit less descriptive that "pst". But for a "method", I think that's acceptable. > (It'd be even better for grepability/readability if the implementations > and hook name agreed, like: > > - result->read_symtab = dbx_psymtab_to_symtab; > + result->read_symtab = dbx_read_symtab; > > or > > - result->read_symtab = dbx_psymtab_to_symtab; > + result->psymtab_to_symtab = dbx_psymtab_to_symtab; Agree as well. I don't mind making these two changes after Yao's commit goes it (unless Yao wants to take care of it, I don't mean to cut in). -- Joel