identifiers and memory

Are the actual identifiers themselves and the data they hold stored in different memory locations in c++?

For example:

int a;
a = 5;

Is the identifier a and the integer 5 stored in different memory locations?
closed account (Dy7SLyTq)
well, if i remember my compiler teachings well, thats not how it works. what happens is (and once again, i am shakey on this so if im wrong correct me) the assembly code generated doesnt have an a variable. instead it associates it with a register and pushes the value 5 onto that register
closed account (zb0S216C)
Identifiers are not stored inside an executable. Identifiers are translated into addresses in memory during compilation based on the host OS's architecture. A piece of data, however, is stored in memory (when loaded from the HDD or given as input during the program's run-time).

Additional Information:

Identifiers exists until linking has been completed. Before linking, the identifiers are mangled (C++ only). Once linking has finished, identifiers are stripped.

Last edited on
Topic archived. No new replies allowed.