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".
Yeah, that's what I figured.
So, no, you'll have to do it "the hard way".
Agreed. Seems like a rather illogical oversight to be able to able to define a "type" for a function but not actually be able to declare functions of that "type" (except as pointers to them), but that's we've got.
C CHALLENGE: can you write a function that returns a function pointer which has the same signature as the function itself? (Without using one-or-more big hammer casts.) Useful trick for making a state machine.
I supposed I could come up with a way, but nothing comes to mind immediately :-)