How does compiler optimisation done with respect to this code?

22 Views Asked by At

I am getting two different answers in two different compiler .

#include<stdio.h>
#define square(a) a*a
main()
{
    int a=3;
    printf("%d ",square(a++));
    printf("%d ",square(a--));
}

In gcc 4.x versions output is 9 and 25 In newer gcc 12 and 20 are the outputs How are the newer compilers handling this compiler optimization? I want to know about the volatile in such compiler optimization issues.

0

There are 0 best solutions below