I think it should be 01 but someone says its \"undefined\", any reason for that?
As I see it, f(c++); is equivalent to: f(c); c += 1;
And f(c++,c++); is equivalent to: f(c,c); c += 1; c += 1;
But it may be the case that f(c++,c++); becomes f(c,c+1); c+= 2;
An experiment with gcc and clang, first in C
#include
void f(int a, int b) {
printf("%d %d\n",a,b);
}
int main(int argc, char **argv) {
int c = 0;
f(c++,c++);
return 0;
}
and in C++
#include
int main(int argc, char **argv) {
int c = 0;
std::cout << c++ << " " << c++ << std::endl;
return 0;
}
Is interesting, as gcc and g++ compiled results in 1 0 whereas clang compiled results in 0 1