Question : What Does This Cast Say

void (*function)(unsigned long);

I'm having a bit of trouble reading this cast. Can someone kindly tell me what the type of the variable is.

For completeness, it is part of the struct timer_list from <linux/timer.h>:
1:
2:
3:
4:
5:
6:
7:
8:
struct timer_list
{
    struct list_head entry;
    unsigned long expires;
    void (*function)(unsigned long);   // this line
    unsigned long data;
    struct tvec_t_base_s * base;
}

Answer : What Does This Cast Say

That is not a cast. Using the right-left rule, function is a pointer (right; hit paren, so left).

A pointer to a function call (right to (...) ).
The function call takes one input parameter whose type is unsigned long.

Moving left, the function will return a void.

Putting it together,
function is a pointer to any function that takes one input parameter whose type is unsigned long, and which returns void.
Random Solutions  
 
programming4us programming4us