I done an analysis of the code. In both cases the static variable is used as an argument to ExecuteMacro(). ExecuteMacro() then proceeds to immediately copy the values.
I came to the following conclusions: Because the values are not used past the beginning of ExecuteMacro() and none of the fields are conditionally set, so the static one time initialization is not a problem. This tells me that as the code stands right now it is safe. The variables being static was probably written as a speed optimization and nothing more. The current state is fragile but stable. Meaning that it will survive minor maintenance but is a potential land mine to any major code manipulation at a later date. Removing the static would be safe. -Steve -- Steve LoBasso mailto:[EMAIL PROTECTED] http://slobasso.tripod.com/ ----- Original Message ---- From: Scott Tringali <[EMAIL PROTECTED]> To: NEdit development list <[email protected]> Sent: Monday, March 10, 2008 8:27:02 AM Subject: Re: smartIndent.c: remove static Thorsten Haude wrote: > The question is of course why they are static in the first place. I don't know a whole lot about the macro interpreter, but... If simply removing static was the right thing to do, the author or commenter probably would have done it. There is probably a reason it's there. Passing off a local variable to another routine, which may store the value and use it later isn't a good idea. Probably, it needs to be dynamically allocated and properly managed. That's the way I read it that comment. -- NEdit Develop mailing list - [email protected] http://www.nedit.org/mailman/listinfo/develop ____________________________________________________________________________________ Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping -- NEdit Develop mailing list - [email protected] http://www.nedit.org/mailman/listinfo/develop
