From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18845 invoked by alias); 16 Apr 2012 18:53:14 -0000 Received: (qmail 18834 invoked by uid 22791); 16 Apr 2012 18:53:13 -0000 X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_DNSWL_NONE,RCVD_IN_HOSTKARMA_NO,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY X-Spam-Check-By: sourceware.org Received: from mailout09.t-online.de (HELO mailout09.t-online.de) (194.25.134.84) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 16 Apr 2012 18:52:59 +0000 Received: from fwd24.aul.t-online.de (fwd24.aul.t-online.de ) by mailout09.t-online.de with smtp id 1SJr2o-0003oi-2E; Mon, 16 Apr 2012 20:52:58 +0200 Received: from [192.168.0.104] (TWjCj4ZZoh-iCM8QAeglj2xcvzRHjsLiVEoBneLDcazvXDkIBMOPHlhlgdTWVSbgzq@[93.218.172.9]) by fwd24.t-online.de with esmtp id 1SJr2m-2IJ5F20; Mon, 16 Apr 2012 20:52:56 +0200 Subject: Re: Switching to C++ by default in 4.8 From: Oleg Endo To: Chiheng Xu Cc: gcc In-Reply-To: References: <4F7B356E.9080003@google.com> <4F7C35A3.3080207@codesourcery.com> <20120410084614.GJ6148@sunsite.ms.mff.cuni.cz> Content-Type: text/plain; charset="UTF-8" Date: Mon, 16 Apr 2012 18:53:00 -0000 Message-ID: <1334602375.19154.243.camel@yam-132-YW-E178-FTW> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2012-04/txt/msg00667.txt.bz2 On Mon, 2012-04-16 at 04:11 +0800, Chiheng Xu wrote: > On Sat, Apr 14, 2012 at 11:47 AM, Chiheng Xu wrote: > > > > And I want to say that tree/gimple/rtl are compiler's data(or state), > > not compiler's text(or logic), the most important thing about them is > > how to access their fields. > > > > Given the above assumption, now I doubt the necessity of accessor > macros or C++ getter/setter method. According to my experience, it doesn't take more time/effort to write "tree->code ()" instead of "tree->code" and such getter functions allow for easier refactoring etc. If you omit the getters/setters you can't express things such as immutable objects (well you still could with const ivars but...), and you'll always have to have the ivar... > > Is "tree->code" more direct and efficient than "TREE_CODE(tree)" or > "tree->get_code()" ? What do you mean by efficient? All of them will (most likely) end up as the same machine code. But still, there's a reason why there's a TREE_CODE getter which is supposed to be used instead of writing "tree->base.code" everywhere... Cheers, Oleg