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: [tree-ssa] AST optimizer in C++?


Gabriel Dos Reis wrote:
Per Bothner <per@bothner.com> writes:
| Perhaps something like:
| | class Tree {
| union tree_node *node;
| };

| Or:
|
| class Tree {
| union tree_common common;
| }

Since the class Tree will base class, it is likely that we will
exclusively using pointers to Tree, then the second declaration saves
an unnecessary indirection.
If we use the first definition, my assumption is that parameters,
locals, and return types would normally by Tree, Decl, etc, rather than
Tree*, Decl*, etc.  If we use the second versions, then we would be
mostly passing Tree*, Decl*, etc, and never Tree, Decl, etc.

I'd leave it to someone more experienced  with "good C++ practice"
than myself to evaluate the pros and cons of the two.

Well, I have some impression that there are some sentiment against C++
somewhere... Well, I wish that impression were wrong...
Well, there are the practical concerns about making boot-strapping more
complex, etc.  I share those, too, but I think better data abstraction
(including better tools for memory management and compile-time type
checking) would more than make up for it.

Then there are people who are in principle opposed to using C++ rather
than C.  I don't know how many there are of them, but they're wrong ...
I'm assuming very use of very limited C++, mainly the data abstraction
features.  No multiple inheritance, and at least initially no virtual
functions, no exceptions, and no templates.  (Perhaps some limited
use of STL.)

In any case, it's not going to happen unless someone comes up with a
good design, and illustrates its use, perhaps with a new (and optional)
optimization.
--
	--Per Bothner
per@bothner.com   http://www.bothner.com/per/


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