Even after programming in C for decades, I occasionally still discover things about it. While
typedefs of pointer to function are common, I just discovered that you can have
typedefs of function by stumbling across their use in some open-source project (though I don't recall which one). That is instead of the common:
typedef void (*PF)(int); PF pf; // pf is a pointer to function
you can instead do:
typedef void F(int); F *pf; // pf is (also) a pointer to function
One advantage the latter is that it makes it more obvious that you're dealing with pointers.
I suppose the reason for not knowing about
typedefs of function is that there are no such examples in either the first or second editions of The C Programming Language (though there are examples of
typedefs of pointer to function). There is, however, an example in the C99 standard §126.96.36.199:
typedef int MILES, KLICKSP();
extern KLICKSP *metricp;
are all valid declarations. The type of ...
metricpis ‘‘pointer to function with no parameter specification returning int’’ ....