What is the advantage in reducing variables in vb6?
I have a code written in VB6. There I have some variable which can be removed by some code manipul开发者_开发问答ation? Is there any advantage of removing one or two extra variables?
Instead of removing variables (how else do you refer to anything?) just reduce their scope.
There are generally two reasons given for removing local variables.
- The program uses a little less memory, this is very minor and not the reason to remove the variables.
- The code becomes a lot a clenaer, easier to read and a lot less complex. (This is the real reason to remove the variables).
Since (especially true with VB6) maintenance is where you spend 90% of your time programming, its worth making your life a little easier.
By removing variables the code MAY look more clean, but not necessarily more readable.
Advantages:
- less memory
- more speed
However, I would not worry about it much, unless it is inside a loop. You should clear up variables not really required inside a loop
精彩评论