> When I read "int a = 1" in C#, I implicitly translate that to "take a 4 byte piece of memory on the stack, and set it equal to 1".
I think that's overspecifying a bit. It could be kept in a register rather than the stack. And due to to the Single Static Assignment transformation that modern optimising compilers do, variables don't correspond exsctly to registers anymore; each time you modify the variable, it becomew a new variable, and then the compiler removes or changes extraneous modifications and dead code. It only keeps track of the values that move through the code. You could really only count on variables corresponding exactly to stack space registers before the SSA form existed.
I think that's overspecifying a bit. It could be kept in a register rather than the stack. And due to to the Single Static Assignment transformation that modern optimising compilers do, variables don't correspond exsctly to registers anymore; each time you modify the variable, it becomew a new variable, and then the compiler removes or changes extraneous modifications and dead code. It only keeps track of the values that move through the code. You could really only count on variables corresponding exactly to stack space registers before the SSA form existed.