R
rz0
Hi,
I have a function that takes a callback function (function pointer of
some type) and a value to be passed to it when it is invoked later. The
prototype looks pretty much like :
int reg(int (*)(void *), void *);
Now, it appears that most of the values (second argument) I want to
register have types of the form T * restrict *, that is, a pointer to
a restricted pointer to some type T. Since there is no implicit
conversion to void *, I have to cast each time I make a call to the
registration function.
I would like to have a different prototype for such cases so the cast
becomes unecessary. If it were const, then using const void * would be
a solution but restrict cannot be applied to void. Is there any elegant
alternative to the problem ?
Thanks
I have a function that takes a callback function (function pointer of
some type) and a value to be passed to it when it is invoked later. The
prototype looks pretty much like :
int reg(int (*)(void *), void *);
Now, it appears that most of the values (second argument) I want to
register have types of the form T * restrict *, that is, a pointer to
a restricted pointer to some type T. Since there is no implicit
conversion to void *, I have to cast each time I make a call to the
registration function.
I would like to have a different prototype for such cases so the cast
becomes unecessary. If it were const, then using const void * would be
a solution but restrict cannot be applied to void. Is there any elegant
alternative to the problem ?
Thanks