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
If i'm correct, this is happening:
with MAX replaced with (a>b...) you have printf("%d %d %d\n",a,b,(a++ > b++ ? a++ : b++ ) );
First, a++ > b++ is checked and both values increased (a = 4, b = 5) afterwards. Then the second b++ gets active, but because it's postincrement, it's increased after the second value b = 5 is printed.
Sorry for my bad english, but i hope you understand it?! :D
Greeings from Germany ;-)
Ralf