In article <KV************ *******@news.in digo.ieFrederic k Gotham <fg*******@SPAM .comwrites:
Dik T. Winter:
The following is a bit complicated:
void (*(*f)(int (*)(int)))(int (*)());
cdecl has no problems with it.
....
Now all those f's below are a bit confusing:
(1) f is a pointer.
(2) f is a function whose sole parameter is a pointer to an int-returning-
function whose sole parameter is an int.
(3) f is a pointer.
(4) f is a void-returning-function whose sole parameter is a pointer to an
int-returning-function whose parameter list is void.
(1) and (2) are correct, but this description makes not clear what the
original f does return.
....
It shouldn't be too hard to work with the type now. I'd post example code,
but I can't think of any contrived usage which wouldn't come across as
utterly facetious (given the obscure nature of the type in question).
Obscure? From signal.h under Solaris:
int (*sigset(int, int (*)(int)))(int) ;
I think that declaration has been in there since BSD times. If f were
declared as:
int (*(*(*f)(int (*)(int)))(int, int (*)(int)))(int) ;
it might have been a function that took as parametera sighandler and
returned something of the type of sigset.
cdecl is quite handy at times. For the one I gave above:
cdeclexplain void (*(*f)(int (*)(int)))(int (*)());
declare f as pointer to function (pointer to function (int) returning int)
returning pointer to function (pointer to function returning int)
returning void
cdecl>
--
dik t. winter, cwi, kruislaan 413, 1098 sj amsterdam, nederland, +31205924131
home: bovenover 215, 1025 jn amsterdam, nederland;
http://www.cwi.nl/~dik/