Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Here's an example:

    typedef void (*sighandler_t)(int);
    sighandler_t signal(int signum, sighandler_t handler);
Without the typedef, it's much less clear.

Edit: It could instead be written as the non-pointer type:

    typedef void (sighandler_t)(int);
And then used as:

    sighandler_t *signal(int signum, sighandler_t *handler);
And as a function declaration:

    sighandler_t foo;
With the pointer in the typedef, the type can't be used to declare functions.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: