Is it possible to implement a macro conditional inside a macro function in C. Something like this:
#define fun(x)
#if x==0
fun1;
#else
fun2;
#endif
#define fun1 // do something here
#define fun2 // do something else here
In other words, preprocessor decides which macro to use based on an argument value.
fun(0) // fun1 is "preprocessed"
fun(1) // fun2 is "preprocessed"
I know that this example doesn't work, but I want to know is it possible to make it work somehow?
M.