Function typedefs have any use?

Gabriel Dos Reis gdr@integrable-solutions.net
Sun Feb 6 23:10:00 GMT 2005


"Kevin P. Fleming" <kpfleming@starnetworks.us> writes:

| Gabriel Dos Reis wrote:
| > "Kevin P. Fleming" <kpfleming@starnetworks.us> 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)

No, that is not the way you define a function.
You can declare a function with a syntax like variable declaration;
but you can't use that syntax to *define* the function.  You need the
full blown syntax.  You can't get away with that one.

-- Gaby



More information about the Gcc-help mailing list