Classes
Philip Herron
redbrain@gcc.gnu.org
Fri Apr 15 06:39:00 GMT 2011
On 5 April 2011 08:44, charfi asma <charfiasma@yahoo.fr> wrote:
>
>
> Hello Phil,
>
> have a look at those post:
>
> http://gcc.gnu.org/ml/gcc-help/2010-11/msg00019.html
> http://gcc.gnu.org/ml/gcc-help/2010-10/msg00388.html
>
> I got the same problem when I want to add a method to my class.
>
> hope it helps
>
Hey
Thanks for those links i am a little confused still not sure if i've
done everything right.
Say for example i wanted to implment this:
int main() ()
{
int D.1710;
{
struct myClass test;
myClass::set_values (&test, 3, 4);
D.1710 = 0;
return D.1710;
}
D.1710 = 0;
return D.1710;
}
void myClass::set_values(int, int) (struct myClass * const this, int a, int b)
{
this->x = a;
this->y = b;
}
Which is the gimple dump of:
class myClass
{
int x, y;
public:
void set_values (int, int);
};
void myClass::set_values (int a, int b)
{
x = a;
y = b;
}
int main ()
{
myClass test;
test.set_values (3,4);
return 0;
}
I make a RECORD_TYPE called myClass and having FIELD_DECLS for x and y.
set_values = FUNCTION_DECL....
Then i use TYPE_METHODS(myClass) = set_values
Then i dont understand how i call the method not sure how i use the
build_call_expr to do that.
More information about the Gcc-help
mailing list