This is the mail archive of the
mailing list for the GCC project.
Re: Using C++ in GCC is OK
- From: åææ <chiheng dot xu at gmail dot com>
- To: Mark Mitchell <mark at codesourcery dot com>
- Cc: GCC <gcc at gcc dot gnu dot org>
- Date: Mon, 31 May 2010 18:29:44 +0800
- Subject: Re: Using C++ in GCC is OK
- References: <4C030228.firstname.lastname@example.org>
On Mon, May 31, 2010 at 8:26 AM, Mark Mitchell <email@example.com> wrote:
> I am pleased to report that the GCC Steering Committee and the FSF have
> approved the use of C++ in GCC itself. ÂOf course, there's no reason for
> us to use C++ features just because we can. ÂThe goal is a better
> compiler for users, not a C++ code base for its own sake.
C++ is an amazing language.
C++'s three main features(encapsulation, inheritance, polymorphism)
can greatly improve the GCC's code base, render it more modular and
readable and let GCC developer to think at a more abstract layer.
In GCC, there are too many data structures that can be encapsulated as
ADT(Abstract Data Type), like sbitmap, bitmap, struct real_value,
struct sreal, double_int, HWI, etc. I will glad to see these data
structures can be used as conveniently as string in C++.
The complexity and irregularity of TREE and RTL IRs may be the
biggest hurdle to use inheritance and polymorphism on them.
Language hooks and target hooks can be easily replaced by virtual methods.
I have FUD on the use of "advanced" C++ features like template(even
standard template), namespace, exceptions. This is partly because my
favorite source code analyzer can not handle them properly. I have
tried to use my favorite source code analyzer to analyze LLVM source
code, which use C++ standard template aggressively, the result is not
ideal . I also have tried to use it to analyze Open64 source code,
which does not use template, the result is much better .It would be
nice if there are another template-free encapsulation over standard
template. For example, an template-free container encapsulating
standard container template.