Take look at the code that follows.
"Hello " "World!";
"The number is ", 37;
int x=23;
char *y="232";
x,x+2,x*3;
atoi(y) - x;
It is a perfectly valid fragment of C(99) source.
But! All that expressions return to nowhere!
How can one trace or even use all this anonymous values?
Where are they stored and what is their purpose?
From a functional point of view, all those expressions’ results are lost. If good optimizations are at work, they are not computed at all. But let us suppose they are. In this case “where” the results are available depends on how the compiler translated the code, a fact that can be considered unpredictable.
On x86 machines, you can think that integer results and pointer results are stored into eax (that then will be trashed), but it is just a supposition; if it is true for a specific compiler and code, it could be not for another compiler or if you change a bit the code. It could also happen that the values are pushed on the stack, which then it’s incremented again, so that, until it is not reused, you can find the value on the stack. Same arguments as for
eaxcan be done.The part tied through the comma are someway different. Things like
a, bare read as “execute a, discard any result and then execute b”, so that the result of a is lost “by definition” (of course, looking at the asm code, you could also in this case find that it is still available somewhere, but likely it is indeed not after b is evaluated)