A
Andreas Klimas
hello,
no many words, I will start with an example instead
int foo(void *r) {...}
void test(void) {
int *x=0;
foo(x); /* seems to me as valid */
}
--------------------------------------------------------------
int foo(void(*cb)(void*r)) {...}
void bar(int *x) {...}
void test(void) {
foo(bar); /* seems to me as valid, but not for the compiler */
}
the question now is hopefully obvious. why can't I assign
a functionpointer where the only difference is void* vs.
int* in its arguments. the direct way is allowed, but the
indirect isn't. do I miss any important point (i think so).
thanks
best wishes
Andreas Klimas
no many words, I will start with an example instead
int foo(void *r) {...}
void test(void) {
int *x=0;
foo(x); /* seems to me as valid */
}
--------------------------------------------------------------
int foo(void(*cb)(void*r)) {...}
void bar(int *x) {...}
void test(void) {
foo(bar); /* seems to me as valid, but not for the compiler */
}
the question now is hopefully obvious. why can't I assign
a functionpointer where the only difference is void* vs.
int* in its arguments. the direct way is allowed, but the
indirect isn't. do I miss any important point (i think so).
thanks
best wishes
Andreas Klimas