I have gotten into a debate concerning the use of constants for numbers:
The question was raised: Which of the following:
1. is more/less efficient
2. how much more/less effiecient
3. and if more efficient, when should it be used, and not used?
4. Solid arguments for the pros and cons (no baseless answers please).
Global Const g0% = 0
Global Const g1% = 1
Dim myInteger as Integer
myInteger = 1
Or
myInteger = g1
If the second choice, then should this be done for all numbers used, or just the top 100/most used?
Say, the program uses 1000 zeros and the same number of ones.
(If the 2nd, then shouldn't I be replacing all (most used) numbers with the constants?)
----------------------------------------------------------
Please note:
The discussion is not concerning strings, but numbers.
The discussion is not concerning the use of constants to make the code easier to read (like a set value).
But just simple used numbers. Even to the use on a conditional branch, say, in an Select Case on the Index on a control array.
I have stated my views in the discussion, but as opposed to using constants for strings or fixed values, my arguments are not (Technically) solid enough to offer the needed validated facts.
The question was raised: Which of the following:
1. is more/less efficient
2. how much more/less effiecient
3. and if more efficient, when should it be used, and not used?
4. Solid arguments for the pros and cons (no baseless answers please).
Global Const g0% = 0
Global Const g1% = 1
Dim myInteger as Integer
myInteger = 1
Or
myInteger = g1
If the second choice, then should this be done for all numbers used, or just the top 100/most used?
Say, the program uses 1000 zeros and the same number of ones.
(If the 2nd, then shouldn't I be replacing all (most used) numbers with the constants?)
----------------------------------------------------------
Please note:
The discussion is not concerning strings, but numbers.
The discussion is not concerning the use of constants to make the code easier to read (like a set value).
But just simple used numbers. Even to the use on a conditional branch, say, in an Select Case on the Index on a control array.
I have stated my views in the discussion, but as opposed to using constants for strings or fixed values, my arguments are not (Technically) solid enough to offer the needed validated facts.