#150496 - 2005-10-25 04:16 PM
Re: Question on Best Practices
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
Quote:
The whole memory allocation thing is a little long to explain. Basically, it was my understanding that by declaring a variable before setting it you were actually telling the interpreter to set aside or allocate resources or something like that.
The "Explicit" option has no effect on memory. As discussed earlier it is simply a runtime switch to instruct the interpreter how to deal with undeclared variables when it encounters them.
However, having Explicit set means that you *do* have to declare all your variables at some point. You don't need to do it at the start of the code, but you do need to do it before you use the variable. You must also only declare the variable once per scope (except for ReDim).
This is a Good Thing 
As at some time during the script runtime you will need to declare your variable, either explicitly by DIMming it or implicitly by referencing it, there is no additional overhead to explicitly declaring it up-front.
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 1046 anonymous users online.
|
|
|