existing functionality questions

Michael Tegtmeyer tegtmeye@mail.eecis.udel.edu
Wed Sep 7 17:25:00 GMT 2005


> If you just have a regular object passed by value, the fields accessible
> are those in TYPE_FIELDS of the type of the object, and those fields
> reachable through types in the TYPE_BINFOS (i don't remember whether we
> represent access control in binfos)

Ah, I guess I am not actually wording this correctly:) I am able to get to 
all of the fields without any problem. I guess what I mean by visible is 
with regard to public vs private and context. In my example:

class A {
   public:
     int pub_var;

     void foo(/*implicit this* */) {...}

   private:
     int private_var;
};


void bar(A *a) {...}


In a call to foo(). The implicit this pointer has type A with fields 
pub_var and private_var. (both accessable with TYPE_FIELD) The same is 
true for bar. In each case, TREE_PRIVATE is true on private_var. foo() can 
obviously access private_var because foo() is a member function whereas 
bar() is cannot. This is the visibilty that I'm refering to. Currently, 
I'm just comparing the DECL_CONTEXT of the argument and the context of the 
function but it breaks when it comes to inheritance.

Is there a better way of going about this?

Thanks again,
Mike



More information about the Gcc mailing list