Umesh said:
what this statement &(*IR)->func means.
where IR is the pointer to structure & func is pointer to fuction.
func is the member of structure.
a->b is the same as (*a).b. Thus, IR cannot be a pointer
to struct but is a pointer to a pointer to struct, as
it is dereferenced twice:
(*IR)->func means (**IR).func
Now, you apply the address operator.
This gives you the address where the function pointer (**IR).func
is stored.
Observe:
#include <stdio.h>
int main (void)
{
struct test {
int filler;
void (*func)(void);
} instance, *pinst, **IR;
int offset = offsetof(struct test, func);
instance.filler = 0;
instance.func = NULL;
pinst = &instance;
IR = &pinst;
printf("inst: %p func: %p %p\n", (void *)(&instance),
(void *)(&instance.func), (void *)(&(*IR)->func));
printf("distance: %d %d\n", (int) offset,
(int) ((unsigned char*)(&(*IR)->func)-(unsigned char*)(*IR)));
return 0;
}
Cheers
Michael