From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3173 invoked by alias); 26 Nov 2012 20:43:23 -0000 Received: (qmail 3164 invoked by uid 22791); 26 Nov 2012 20:43:22 -0000 X-SWARE-Spam-Status: No, hits=-1.2 required=5.0 tests=AWL,BAYES_00,KAM_STOCKGEN,RCVD_IN_HOSTKARMA_NO 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; Mon, 26 Nov 2012 20:43:15 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 9E1682E17A; Mon, 26 Nov 2012 15:43:14 -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 Uuxfbn6qJ9Zx; Mon, 26 Nov 2012 15:43:14 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 72D572E30E; Mon, 26 Nov 2012 15:43:12 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 69F59C270B; Mon, 26 Nov 2012 21:43:10 +0100 (CET) Date: Mon, 26 Nov 2012 20:43:00 -0000 From: Joel Brobecker To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: FYI: use SYMBOL_SYMTAB accessor Message-ID: <20121126204310.GD3089@adacore.com> References: <87r4ngicmg.fsf@fleche.redhat.com> <20121126163706.GA3089@adacore.com> <87mwy4gqqs.fsf@fleche.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87mwy4gqqs.fsf@fleche.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: 2012-11/txt/msg00688.txt.bz2 > I'm somewhat on the fence about this, but on balance I think it is a > good idea to make types that are used in more than one file opaque. > > However, in practice this hasn't always helped much. The symbol > accessors are the worst, as we've discussed before, because many of them > are polymorphic without any purpose -- so they are both verbose and hard > to change. In other cases in recent memory, I've wanted to change > direct accessors to separate assignments from uses; and this requires > global changes anyway, meaning that the macros didn't really help all > that much. Yeah - in retrospect, I think we should have required that for our types. I like opaque types (for complex types), because it allows us to control the contents of the data through a well defined API, and then allows us to easily track its use. Our macros serve this purpose to a degree, except that we do not automatically catch mistakes where we access the field directly instead of through the macros. Anyway, I don't think it's really all that important for existing code at the moment. But something perhaps to bear in mind if we ever create new data structures - to ask ourselves whether the type should be opaque or not. Or if we revamp our symbol/types data. -- Joel