Re: Function typedefs have any use?

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

 



Gabriel Dos Reis wrote:
"Kevin P. Fleming" <kpfleming@xxxxxxxxxxxxxxx> writes:

| Eljay Love-Jensen wrote:
| | > But the syntax of C doesn't have the language construct of "here's a
| > label (identifier), here's the type of that label, and here's it's
| > body".

<snip>

You mean like this:

      typedef int F(int);
      F f;      /* function "f" taking an int and returning an int. */

Yes, that's it, and it _does_ work :-)

typedef int F(int);

F f;

f(bar)
{
  return bar * bar;
}

int main()
{
  printf("%d\n", f(6));
}

Running this produces "36", as expected.

Thanks!

[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