|| ||Mark Mitchell <mark-AT-codesourcery.com> |
|| ||GCC <gcc-AT-gcc.gnu.org> |
|| ||Using C++ in GCC is OK |
|| ||Sun, 30 May 2010 17:26:16 -0700|
|| ||Article, Thread
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.
Before we start to actually use C++, we need to determine a set of
coding standards that will apply to use of C++ within GCC. At first, I
believe that we should keep the set of C++ features permitted small, in
part so that GCC developers not familiar with C++ are not rapidly
overwhelmed by a major change in the implementation language for the
compiler itself. We can always use more of C++ later if it seems
appropriate to do so, then.
For example, I think it goes without question that at this point we are
limiting ourselves to C++98 (plus "long long" so that we have a 64-bit
integer type); C++0x features should not be used. Using multiple
inheritance, templates (other than when using the C++ standard library,
e.g. std::list<X>), or exceptions also seems overly aggressive to me.
We should use features that are relatively easy for C programmers to
understand and relatively hard for new C++ programmers to misuse. (For
example, I think constructors and destructors are pretty easy and hard
Because C++ is a big language, I think we should try to enumerate what
is OK, rather than what is not OK. But, at the same time, I don't think
we should try to get overly legalistic about exactly what is in and what
is out. We need information guidelines, not an ISO standard.
Is there anyone who would like to volunteer to develop the C++ coding
standards? I think that this could be done as a Wiki page. (If nobody
volunteers, I will volunteer myself.) Whoever ends up doing this, I
would urge the rest of us not to spend too much time in the C++
coding-standards bikeshed; we're not going to win or lose too much
because we do or do not permit default parameters.
(650) 331-3385 x713
to post comments)