Do longer variable names use more memory?

This forum is dedicated to those who want support programming in ugBASIC.
Questo forum è dedicato a chi desidera supporto per programmare in ugBASIC.
Ce forum est dédié à ceux qui souhaitent prendre en charge la programmation en ugBASIC.
Post Reply
User avatar
wysardry
Posts: 26
Joined: Sun Oct 08, 2023 6:45 pm

Do longer variable names use more memory?

Post by wysardry »

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?
spotlessmind1975
Site Admin
Posts: 149
Joined: Fri Oct 06, 2023 8:25 pm

Re: Do longer variable names use more memory?

Post by spotlessmind1975 »

hi wysardry!
wysardry wrote: Thu Oct 12, 2023 8:01 pm would the former use more memory space after compilation?
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.
Post Reply