This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Using C++ in GCC is OK
Basile Starynkevitch wrote:
> At last, there is a very important issue when switching to C++. What is
> our "ideal" class hierarchy? Do we aim at a large forest, or on the
> contrary at a single tree of classes, so we have a single root class,
> providing common services (dump or debug printing, serialization, ...)
> or not?
There's no reason to get into these kinds of questions at this point.
The goal is not to reimplement GCC from the ground up using modern
OO/C++ techniques. The goal is simply to permit ourselves to use C++
features where appropriate in the codebase.
With respect to a class hierarchy, we already have inheritance in a few
places. For example, the "tree" data structures are inheriting from a
base class by doing things like:
struct tree_derived {
struct tree_base base;
/* derived fields here. */
};
It's natural to use actual C++ inheritance there. But, there's no a
priori reason to start making other things inherit from each other or
start trying to factor out base classes that we don't currently have,
unless it's actually demonstrably useful to do so.
--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713