Here\'s some more weird macro behavior I was hoping somebody could shed light on:
#define MAX(a,b) (a>b?a:b)
void main(void)
{
int a = 3, b=4;
print
So your expansion gives (adjusted for clarity):
(a++ > b++) ? a++ : b++
... so (a++ > b++) is evaluated first, giving one increment each and selecting a branch based on the not-yet-incremented values of a and b. The 'else' expression is chosen, b++, which does the second increment on b, which was already incremented in the test expression. Since it's a post-increment, the value of b before the second increment is given to printf().