J
John Blevin
I can play games with macro names, to do something like:
#define MACRO_TYPE_FOO(arg) { some_function(arg); }
#define MACRO_TYPE(arg1, arg2) MACRO_TYPE_##arg1(arg2)
MACRO_TYPE(FOO, 5);
But if I try to define a macro to represent the arguments, it doesn't
work:
#define my_args FOO, 5
MACRO_TYPE(my_args);
In this case it first evaluates the MACRO_TYPE and forms
a MACRO_TYPEmy_args (which of course is not defined), it does this
before expanding the my_args. Do you know if there is a way
to get it to expand the my_args before the MACRO_TYPE?
Thanks!
- John
#define MACRO_TYPE_FOO(arg) { some_function(arg); }
#define MACRO_TYPE(arg1, arg2) MACRO_TYPE_##arg1(arg2)
MACRO_TYPE(FOO, 5);
But if I try to define a macro to represent the arguments, it doesn't
work:
#define my_args FOO, 5
MACRO_TYPE(my_args);
In this case it first evaluates the MACRO_TYPE and forms
a MACRO_TYPEmy_args (which of course is not defined), it does this
before expanding the my_args. Do you know if there is a way
to get it to expand the my_args before the MACRO_TYPE?
Thanks!
- John