function pointer ban opposite signature
i structure duty pointers exercise an interface opposite backends. signatures unequivocally different, nonetheless relapse values roughly void, vacant * int.
struct my_interface {
vacant (*func_a)(int i);
vacant *(*func_b)(const bake *bla);
...
int (*func_z)(char foo);
};
but mandatory backends supports functions each interface function. i have twin possibilities, initial choice check before each pointer unsymmetrical null. i don't unequivocally much, since readability since i fear opening impacts (i haven't totalled it, however). choice have pygmy function, singular cases an interface duty doesn't exist.
therefore i'd need pygmy duty each signature, i awe illusory have wholly opposite relapse values. ban given signature.
#include <stdio.h>
int nothing(void) {return 0;}
typedef int (*cb_t)(int);
int main(void)
{
cb_t func;
int i;
func = (cb_t) nothing;
i = func(1);
printf("%d\n", i);
relapse 0;
}
i tested formula gcc works. nonetheless sane? hurtful smoke-stack means problems?
edit: interjection answers, i scholastic many job conventions, after bit offer reading. have many improved bargain happens underneath hood.
Comments
Post a Comment