From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32208 invoked by alias); 28 Jun 2010 20:57:15 -0000 Received: (qmail 32199 invoked by uid 22791); 28 Jun 2010 20:57:14 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00 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, 28 Jun 2010 20:57:07 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 7455A2BAB66; Mon, 28 Jun 2010 16:57:05 -0400 (EDT) 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 KaxuZEUzgIQe; Mon, 28 Jun 2010 16:57:05 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 43FA12BAB65; Mon, 28 Jun 2010 16:57:05 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id E0169F5895; Mon, 28 Jun 2010 13:57:01 -0700 (PDT) Date: Mon, 28 Jun 2010 20:57:00 -0000 From: Joel Brobecker To: Tom Tromey Cc: Jan Kratochvil , gdb@sourceware.org Subject: Re: gdbtypes.h #defined field accessors Message-ID: <20100628205701.GC2700@adacore.com> References: <20100624195656.GA19643@host0.dyn.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2010-06/txt/msg00141.txt.bz2 > In new code I don't generally write accessors. I don't know if this is relevant to this particular discussion, but I tend to like opaque structures and accessors (setter/getter) functions, and I try to use that when writing new code. The idea is that it's just very easy to figure out who's reading the data, and who's modifying it. Sometimes, it's the only way to go, because the data structures are complex enough that we shouldn't expose their contents, but even for simple data structures, this can be handy. -- Joel