This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: "self" keyword
- From: Ian Lance Taylor <iant at google dot com>
- To: "Rick C. Hodgin" <foxmuldrster at yahoo dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Thu, 14 Jun 2012 09:48:07 -0700
- Subject: Re: "self" keyword
- References: <4FD9FEBC.9020308@yahoo.com>
"Rick C. Hodgin" <foxmuldrster@yahoo.com> writes:
> How hard would it be to implement a "self" keyword extension which
> references the contextual function name wherein it was referenced?
>
> int foo(int a)
> {
> // recursion
> self(a + 1);
> }
>
> int food(int a)
> {
> // recursion
> self(a + 1);
> }
>
> Obviously not a useful example, but demonstrates that to call each
> function it's in again that it can be done without knowing the
> function name.
I assume you are asking about C? It would be easy to implement. The
compiler always know what function it is compiling. But I don't think
the extension would be accepted back into GCC mainline.
Ian