Obviously the compiler has to store the information whether variable x is unsigned int or signed int, float or whatever, but where and how?
Is there some sort of lookup table? Where in memory do I find it, in which section of the executable?
Obviously the compiler has to store the information whether variable x is unsigned int or signed int, float or whatever, but where and how?
Is there some sort of lookup table? Where in memory do I find it, in which section of the executable?
It is implicit, in the instructions that the compiler chose.
For instance, if address 18 contained a float
, the compiler may use an instruction to load a floating-point register from address 18. And if it's neighbor at address 20 contained an int
, the compiler may load an integer register from the previous address + 2.
As already mentioned, the compiler has a symbol table so it knows where all variables are. This allows it to pick the right instructions. But you can't simply derive the contents of that symbol table from individual instructions.
C and C++ implementations usually do not store variable names anywhere, unless you enable debugging information. Variable names are not needed for normal execution, with the exception of exported symbols from shared objects or DLLs.