Same with what I suggested:
#include <stdio.h>
#define MYMACRO(a,b,c) \
({ \
typeof (c) _c = (c); \
a = b + _c; \
b = _c * 2; \
})
int main() {
int a = 0, b = 0;
if (1)
MYMACRO(a,b,1);
else
MYMACRO(a,b,2);
printf("%d, %d\n", a, b);
}
----- $ gcc -o test test.c
$ ./test
1, 2
Edit: Just for context: this was responding to a post pointing out that the do-while construct allows you to use a semi-colon after the macro invocation.