2 ms·
It might be possible perhaps to use a macro that passes a structure and extracts the elements (at least if the compiler supports GNU extensions); I don't know i
by zzo38computer 6y ago
It might be possible perhaps to use a macro that passes a structure and extracts the elements (at least if the compiler supports GNU extensions); I don't know if the compiler will be able to optimize that in all cases, though.
Example:
static int xyzzy_(int x,int y) {
printf("x=%d\ny=%d\n",x,y);
return x*y;
}
typedef struct {
int x,y;
} xyzzy_parameters;
#define xyzzy(...) ({ const xyzzy_parameters macro_args={__VA_ARGS__}; xyzzy_(macro_args.x,macro_args.y); })
int main(int argc,char**argv) {
printf("[%d]\n",xyzzy(.x=6,.y=7));
return 0;
}