I want to have a Static array in a subroutine, and I want to prevent it from being re-initialized with the same data every time the subroutine is called (to speed up processing), will a Static array be initialized only once, and then never again even thought there are a few instructions placing data into the array at the beginning of the subroutine?
-Tony
Static Arrays and pre-initialized data
Re: Static Arrays and pre-initialized data
Yes. All statically allocated variables, whether defined at the module level or with the static attribute within a procedure, are initialized early in the startup process before Main() is invoked.spamiam wrote:will a Static array be initialized only once
Defining a variable with the static attribute within a procedure gives you exactly the same effect as defining a variable at the module level except that it can only be seen from within the procedure.
- Don Kinzer