i am writing HW code and required to crate one macro where user can pass different argument. My macro will make sure that each argument get written on some memory location.
#define my_macro (.......) { \
int *data1 = (int *) addr1 ; \ #if args1 is present
int *data2 = (int *) addr2 ; \ #if args2 is presnet
.
.
*data1 &= args1;
*data2 &= args2;
.
.
}
ex1 : my_macro(data1,data2); ex2 : my_macro(data1,data2,data3,data4);
also data1 and data2 should be declare only when args is present. ex. if args is not present my_macro(data1)
that case *data1 &= args1;
should not be get declare.
tired to use __VA_ARGS__
thing but dont know how to separate out different variable so i can assign each args to data*
Please help here!