typedef void (*genfunptr)(void);
typedef genfunptr (*fdset_callback_t)(fdset_t);
fdset_callback_t accept_connection(fdset_t set) {
(void)set;
return accept_connection;
}
-> return from incompatible pointer type
The result type for accept_connection is fdset_callback_t .
Referring to the typedef, that's a pointer to a function that takes
fdset_t as an argument and returns as a result a pointer to
a function that has no parameters and returns nothing.
In the function, you return accept_connection which is the
function itself. we know that mentioning a function by name usually
devolves into a pointer to that function, so we're starting right
with a pointer to a function. If we compare signatures, we see that
that pointer-to- function takes fdset_t as an argument, which
matches the argument type we need for the result value.
Now look at the result needed for the pointer-to-function.
fdset_callback_t needs the result of the function to be a pointer to a
function, which is good so far. But that function pointer returned
must, in accordance with genfunptr, be for a function that takes
no arguments -- and that doesn't match the result of accept_connection
because that -does- take a parameter (fdset_t).
You "should" have infinite recursion on the result type for
accept_connection, but you can't build that infinite recursion.
What might perhaps work instead is
typedef void* (*genfunptr)();
That is a function pointer with unspecified arguments that
returns a pointer to -something-. You should probably do
a typecast on the return value of accept_connection to
get it into the theoretically-correct type.