ACliC (gcc) vs CINT

I wrote a simple macro void a(int i, int j , int k){ printf(" i = %d , j = %d , k=%d\n",i,j,k); } void textpp() { int i =0; a(i++,i++,i++); } and execute it via CINT and via ACliC within one and the same ROOT session:

root.exe [0] .x textpp.cxx i = 0 , j = 1 , k=2 root.exe [1] .x textpp.cxx++ Info in <TUnixSystem>: creating shared . . . i = 2 , j = 1 , k=0 root.exe [2]Could someone explain me :blush: why the results :open_mouth: are different :confused: and which one is correct :question:

Hi Valeri,

both are correct. The standard 8.3.6(9) says itโ€™s unspecified.

Axel.

void textpp() {
  int i =0;
  a(i++,i++,i++);
}

This programm contains undefined behavior. First, the order in which arguments evaluated is not specified. But it doesnโ€™t matter - your programm violates 5/4 :

So, none of your results is correct.

gcc on Linux and Solaris-10: 2 1 0
icc on Linux and cc on Solaris-10, CINT : 0 1 2

qed: donโ€™t do it