Testé avec Visual C++ 6 :
#include <stdio.h>
int main(int argc, char* argv[])
{
int x, z;
x = 1; z = 0;
printf("x = %d | z = %d\n", x, z);
z = (x++) + (x++);
printf("x = %d | z = %d\n", x, z);
z = x++ + x++;
printf("x = %d | z = %d\n", x, z);
z = x + (x++);
printf("x = %d | z = %d\n", x, z);
z = x + x++;
printf("x = %d | z = %d\n", x, z);
return 0;
}
donne
x = 1 | z = 0
x = 3 | z = 2
x = 5 | z = 6
x = 6 | z = 10
x = 7 | z = 12
Press any key to continue
et 0 erreurs, 0 warnings
(enfin si 2 :
Compiling...
StdAfx.cpp
Compiling...
test.cpp
C:\dev\test\test.cpp(9) : warning C4100: 'argv' : unreferenced formal parameter
C:\dev\test\test.cpp(9) : warning C4100: 'argc' : unreferenced formal parameter
Linking...
test.exe - 0 error(s), 2 warning(s)
Avec optimisations (max speed):
x = 1 | z = 0
x = 3 | z = 2
x = 5 | z = 6
x = 6 | z = 10
x = 7 | z = 12
Press any key to continue
Avec optimisation (Min Size):
x = 1 | z = 0
x = 3 | z = 2
x = 5 | z = 6
x = 6 | z = 10
x = 7 | z = 12
Press any key to continue
Toutes optimisations :
x = 1 | z = 0
x = 3 | z = 2
x = 5 | z = 6
x = 6 | z = 10
x = 7 | z = 12
Press any key to continue
(j'ai presque l'impression de me repeter..)