This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Using C++ in GCC is OK


On Mon, May 31, 2010 at 8:26 AM, Mark Mitchell <mark@codesourcery.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.
>

Outstanding decision!

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.



-- 
åææ(Chiheng Xu)
Wuhan,China


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]