This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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: METHOD_TYPEs


On Mon, May 25, 2009 at 1:28 PM, Paul Richard Thomas
<paul.richard.thomas@gmail.com> wrote:
> Janus,
>
> In going through tree.def for a completely different reason, I found:
>
> /* METHOD_TYPE is the type of a function which takes an extra first
> ? argument for "self", which is not present in the declared argument list.
> ? The TREE_TYPE is the return type of the method. ?The TYPE_METHOD_BASETYPE
> ? is the type of "self". ?TYPE_ARG_TYPES is the real argument list, which
> ? includes the hidden argument for "self". ?*/
> DEFTREECODE (METHOD_TYPE, "method_type", tcc_type, 0)
>
> It might be interesting to see how these are used in g++....

They are used to repreent the type of what we call
"non-static member function" in C++.

E.g. in

      struct Point {
          int getX() const;
          static Point make_point(int,int);
      };

Point::getX will have a type represented by METHODE_TYPE,
whereas Point::make_point will have a regular FUNCTION_TYPE.

-- Gaby


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