N
nachch
Does the C specification define the order of evaluation of assignment
statements?
For example, what should be the output from the following:
int foo1() { printf("foo1\n"); return 0; }
int foo2() { printf("foo2\n"); return 0; }
int foo3() { printf("foo3\n"); return 0; }
int main()
{
int array[1];
array[foo1()] = foo2() + foo3();
}
I'm asking this question since I'm getting conflicting results on
different compilers, and want to understand whether this is a compiler
bug or not.
gcc prints: foo1, foo2, foo3.
Microsoft Visual C prints: foo2, foo3, foo1.
Thanks.
statements?
For example, what should be the output from the following:
int foo1() { printf("foo1\n"); return 0; }
int foo2() { printf("foo2\n"); return 0; }
int foo3() { printf("foo3\n"); return 0; }
int main()
{
int array[1];
array[foo1()] = foo2() + foo3();
}
I'm asking this question since I'm getting conflicting results on
different compilers, and want to understand whether this is a compiler
bug or not.
gcc prints: foo1, foo2, foo3.
Microsoft Visual C prints: foo2, foo3, foo1.
Thanks.