Re : Classes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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

Asma



----- Message d'origine ----
De : Philip Herron <redbrain@xxxxxxxxxxx>
À : GCC <gcc-help@xxxxxxxxxxx>
Envoyé le : Mar 5 avril 2011, 4h 58min 03s
Objet : Re: Classes

Whoops i pressed space by accident and it send the mail sorry i didnt
get to finish this email, the questions was how would i go about
representing:

class foobar {
  int x,y

  int member_method (int);
}

So i guess you would follow your nomal record_type stuff but i am not
sure what the field_decl should look like for the member_functions.

On 5 April 2011 03:55, Philip Herron <redbrain@xxxxxxxxxxx> wrote:
> Hey all
>
> I am getting my program model in my front-end devloped to be more
> sensible now since all the ground work i've done is now paying off.
>
> And i just have a few questions about creating classes in GENERIC from
> what i've been reading and poking about so far you seem to make a
> RECORD_TYPE then add all your VAR_DECLS as FIELD_DECL's as usual but i
> am unsure how you add in member functions do you do the same thing but
> simply TREE_CHAIN the field decl with the member function name and its
> return type or something but i dont think that makes sense.
>
> Not sure if that made sense well for example i want to represent:
>
> class foobar {
>  int x,y;
>
>
> }
>
>
>
>  i have a record type like:
>
>  tree gpy_object_struct_Type = make_node (RECORD_TYPE);
>
>  name = get_identifier("type");
>  field = build_decl(BUILTINS_LOCATION, FIELD_DECL, name, integer_type_node);
>  DECL_CONTEXT(field) = gpy_object_struct_Type;
>  DECL_CHAIN(last_field) = field;
>  last_field = field;
>
> Then say i wanted to add a member function what should the FIELD_DECL
> look like I am up far too late so its probably really obvious but i am
> too sleepy to realise.
>



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux