I got this code compiled in VC++ and GCC that produces different outputs and appreciate if someone can point me out where the things get wrong.
#include "stdio.h"
#define Cube(x) x*x*x
int main(void){
int x=5;
printf("%d\r\n", Cube(x++));
return 0;
}
In GCC, the displayed value is 210 (=5*6*7) and in VC++2010 its 125 (=5*5*5).
If I do this,
#include "stdio.h"
#define Cube(x) x*x*x
int main(void){
int x=5;
printf("%d\r\n", Cube(++x));
return 0;
}
VC++ prints 512 (=8*8*8) and GCC prints 392 (=7*7*8).
Appreciate if someone can say whats going on.