In C++, I need to defined a macro. That macro would take as parameter a \"block\" of code.
Can we safely use several lines of code as parameter of a macro fu
I think you will need to use extra parentheses to make your expressions look like a single argument which won't get broken up by the preprocessor, i.e. do it more like this:
#define MY_MACRO( (expr) ) DOSOMETHING( (expr) ); DOANOTHERTHING( (expr) ); // etc...
int my_function() {
MY_MACRO(
(int k = AFunction();
k++;
AnotherFunction( k );)
);
}
although I haven't actually tried it.