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]

Re: Multiple inheritance


> 
> > From: "Joshua S. Allen" <allen@eecs.tulane.edu>
> > To: egcs@cygnus.com
> > Date: Mon, 1 Dec 1997 09:05:40 -0600 (CST)
> 
> > (1) I need to construct a table of direct parents of a class.
> 
> Why?  Anyway, you can construct it from BINFO_BASETYPES, but it sounds
> more like you'd just be replicating it.

I've been trying to look at the data in BINFO_BASETYPES using TREE_VALUE but
it just gives me an integer, which I assume it an offset maybe.  Is there a
way to get a string value of the class name?  

For example, if a class named "A" has two direct parents named "B" and "C",
then I would like to retieve the strings "B" and "C." 

> An easier way to do this would seem to me to just redefine hides with
> whatever rules you want.  If you do that, then the rest of the code
> should just work, though I may be missing something because you didn't
> describe what it is you wanted to do very well.  I could give better
> help with a better idea of what it is you wanted to do.
> 

Specifically, what I am doing is computing a linearization of super classes
for each class.  Once I have this linearization, I will use it do automatic
conflict resolution of methods that have the same name in multiple
inheritance.

I already have the linearization algorithm developed in C.  I am now trying
to integrate it into the g++ compiler.  Basically, there are 2 steps: (1)
Compute the superclass linearization for each class. (2) When ambiguity
occurs in multiple inheritance with duplicate class names, resolve it by
using the one that first appears in the linearization.

In order to compute my linearization I need to know only the direct
superclasses of a particular class.  I use this informaiton to recursively
construct the complete linearization for a class.  If a conflict occurs, I
get the clases linearization.  If it has not been computed, then I compute
it.  Then I simply search each class in the lineartion from left to right
until I find the first method with the name I am looking for. 

I hope that helps to describe what I am doing.  Thanks for your help!

--Joshua


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