TIP: Click on subject to list as thread! ANSI
echo: quik_bas
to: BERT BYFIELD
from: CHRIS GUNN
date: 1998-03-23 19:45:00
subject: Re: STATIC Procedure Question

 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)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.