Do longer variable names use more memory?
Do longer variable names use more memory?
If you have two almost identical programs, where one uses the variable name LongVariableName and the other uses LVN, would the former use more memory space after compilation?
-
- Site Admin
- Posts: 171
- Joined: Fri Oct 06, 2023 8:25 pm
Re: Do longer variable names use more memory?
hi wysardry!
From a technical point of view, each "variable" is nothing more than a direct and/or indirect references to memory locations. Therefore, the fact that these references have a long or short name has no effect on the final executable, because it will only use it as a shortcut for a memory address, that occupies always 8 or 16 bits.
Absolutely not: the length of the name of the variables does not influence in any way the length of the program that uses them.
From a technical point of view, each "variable" is nothing more than a direct and/or indirect references to memory locations. Therefore, the fact that these references have a long or short name has no effect on the final executable, because it will only use it as a shortcut for a memory address, that occupies always 8 or 16 bits.