From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5472 invoked by alias); 14 Apr 2012 02:41:20 -0000 Received: (qmail 5237 invoked by uid 22791); 14 Apr 2012 02:41:17 -0000 X-SWARE-Spam-Status: No, hits=-3.3 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-iy0-f175.google.com (HELO mail-iy0-f175.google.com) (209.85.210.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 14 Apr 2012 02:41:02 +0000 Received: by iaag37 with SMTP id g37so5340381iaa.20 for ; Fri, 13 Apr 2012 19:41:01 -0700 (PDT) MIME-Version: 1.0 Received: by 10.43.47.10 with SMTP id uq10mr2542574icb.15.1334371261732; Fri, 13 Apr 2012 19:41:01 -0700 (PDT) Received: by 10.231.150.213 with HTTP; Fri, 13 Apr 2012 19:40:58 -0700 (PDT) In-Reply-To: References: <4F7B356E.9080003@google.com> <4F7C35A3.3080207@codesourcery.com> Date: Sat, 14 Apr 2012 02:41:00 -0000 Message-ID: Subject: Re: Switching to C++ by default in 4.8 From: Chiheng Xu To: Richard Guenther Cc: Bernd Schmidt , Gabriel Dos Reis , David Edelsohn , Diego Novillo , gcc Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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/msg00622.txt.bz2 On Wed, Apr 4, 2012 at 8:04 PM, Richard Guenther wrote: > > I agree for the idea of converting all of GCC to C++ (whatever that means= ). > I disagree for the part making the internal infrastructure easier to use, > understand and maintain. =C2=A0Which means targeting mostly isolated sub-= systems, > like vec.h (and other various containers), double-int.[ch] (and other var= ious > way of representing and working with constants). =C2=A0Making tree or gim= ple a > C++ class with inheritance and whatever is indeed a huge waste of time > and existing developer ressources (that, if only because they have to ada= pt > and maintain two completely different code-bases over some time). > > I expect the GCC core to maintain written in C, compiled by C++. > Making tree or gimple or even rtl a C++ class with inheritance should be ea= sy. Current functions and accessor macros can be preserved. for example: C: typedef struct base_type_tag { int m_data_1; } base_type; typedef struct derived_type_tag { struct base_type base; int m_data_2; } derived_type; #define BASE_TYPE_ACCESSOR_MACRO_1(a) ... #define DERIVED_TYPE_ACCESSOR_MACRO_2(a) ... int base_type _func_1(base_type * p_base, ...) { } int derived_type_func_2(derived_type * p_derived, ...) { } C++: class base_type { int m_data_1; getter_1(); setter_1(); method_1(); }; class derived_type : public base_type { int m_data_2; getter_2(); setter_2(); method_2(); }; #define BASE_TYPE_ACCESSOR_MACRO_1(a) ... #define DERIVED_TYPE_ACCESSOR_MACRO_2(a) ... int base_type _func_1(base_type * p_base, ...) { } int derived_type_func_2(derived_type * p_derived, ...) { } base_type::getter_1() { } base_type::setter_1() { } base_type::method_1() { } derived_type::getter_2() { } derived_type::setter_2() { } derived_type::method_2() { } --=20 Chiheng Xu