这里a
只是一个象征性的名字。如果它是一个局部变量,它就不会存储在任何地方。编译器只是在编译阶段使用它,引用实际值(可以在堆栈上或寄存器中),然后丢弃。
If you looked at the assembly generated by compiler, you'd notice that a
isn't appearing there (or maybe in comments). Compiler will fit your variable somewhere, and just use that location afterwards (like the eax
register on x86).
If you looked at an LLVM assembly (which is quite interesting), you'd notice that the compiler just treats your variables as @1
, @2
, @3
...
On the other hand, if a
would be a global variable (and a non-static
one), the name would actually be used in the symbol table to reference the variable. But it'd be the other way around — variable would be placed somewhere without the name, and the symbol table would map that name to the location so that other programs could find it.
As a side note: if the program is compiled with debug data, the name a
is stored there so that the debugger could display it to help you understanding what's happening.