BB> I read somewhere that procedures should be STATIC, as in:
BB> SUB DoIt (s$) STATIC
BB> FUNCTION DoItAgain (s$) STATIC
BB> Anybody know what this does and why it matters?
Howdy Bert,
STATIC means memory space needed for the subroutine or function is allocated
when you compile your program and all variables used inside the subroutine
will remember where they are each time it's called. It means you have to
ensure any internal variables are cleared if you want them that way.
Subs should normally be declared DYNAMIC (the default) unless you
specifically have variables that are not COMMON or passed to the subroutine
to retain their contents.
It matters a bunch if you are handling a lot of data in memory. STATIC chews
up a lot of memory space you might want for dimensioned arrays or other uses.
With a DYNAMIC subroutine, you can DIM an array inside the sub and it will
use a new DGROUP to allow additional storage. When you exit the sub, the
array is automatically removed from memory to free space back up again.
Chris
--- FMail 0.96â
---------------
* Origin: BIZynet - Worldwide Business via the E-Ways (1:15/55.1)
|