The only time I use a pointer inside the typedef is when dealing with pointers to functions:
typedef void (*SigCatcher(int, void (*)(int)))(int);
typedef void (*SigCatcher)(int);SigCatcher old = signal(SIGINT, SIG_IGN);
Otherwise, I find them more confusing than helpful.
The struck-out declaration is the correct type for a pointer to the
signal()
function, not of the signal catcher. It could be made clearer (using the corrected SigCatcher
type above) by writing: typedef SigCatcher (*SignalFunction)(int, SigCatcher);
Or, to declare the signal()
function:
extern SigCatcher signal(int, SigCatcher);
That is, a SignalFunction
is a pointer to a function which takes two arguments (an int
and a SigCatcher
) and returns a SigCatcher
. And signal()
itself is a function which takes two arguments (an int
and a SigCatcher
) and returns a SigCatcher
.