varname lengths

BlitzPlus Forums/BlitzPlus Programming/varname lengths

Paulo(Posted 2004) [#1]
This is a general coding question..
Suppose I have 100 Global variables each with name lengths of say 7-12 chars, which are quite widely used throughout the program - What I would like to know is, does my program receive much benefit in terms of speed and memory if I optimise them to be shorter when all is done? eg.. Global tg as opposed to Global thisoneisbig. Or are we talking negligible differences?


CGV(Posted 2004) [#2]
We are not talking negligible differences, we are talking NO difference at all because once the program's compiled, all your variable names are converted to 4 byte memory addresses.

Variable names are for your convenience, not the compiler's so use names that reflect what the variable is for so you can easily understand what's going on in your code.


Paulo(Posted 2004) [#3]
excellent! :) thats what i wanted to here. Thank you.


Russell(Posted 2004) [#4]
Of course, you have to find a balance between easily understood names, such as iRocketSpeed and too long to tyoe names, such as iEnemyRocketAttackSpeed...

It's up to you. ;)

Russell


aab(Posted 2004) [#5]
I was wondering about that one two, Thanks!