Here the function prototype manual goes,
Xlib Programming Manual: XSetErrorHandler

Code:
int (*XSetErrorHandler(handler))()
      int (*handler)(Display *, XErrorEvent *)
I'm confused with the first line
Code:
int (*XSetErrorHandler(handler))()
Most people use the function like that
Code:
int (*handler)(Display *, XErrorEvent *) = NULL;
int old(Display *d, XErrorEvent *e){...}
handler = XSetErrorHandler(old);
XSetErrorHandler(handler);
Others direct invoke the function
Code:
XSetErrorHandler(old);
I have no idea how the hell XSetErrorHandler works.

As I understood for XSetErrorHandler()
At first it in the bracket returns one function which returned pf integer value,and then invoke the function.
But it conflicts with
Code:
handler = XSetErrorHandler(old);
which obvisouly return function pointer.


what's the theory of the function?
how hell does function works?



I'm looking forware to the explanation.

Ching.