[crossfire] NPC recursive bug

Alex Schultz alex_sch at telus.net
Sat Aug 5 17:42:34 CDT 2006


Mark Wedel wrote:
>> * add a static variable somewhere to prevent infinite recursion
>>     
>   That'd probably work OK.
I'm a bit inclined against that, because if we ever want to add
threading to the server, a topic that had a significant amount of
discussion on IRC a while ago, we would want to avoid use of static
variables inside of functions wherever possible.
Currently there are many instances of functions returning an internally
defined static char array, to return a string, and to make it work with
threading those would need to be modified to take a char pointer in for
what to output to, and modify all calls to them. Removing unnecessary
static variables may be  a significant amount of work (as I once found
when attempting to start that conversion once), and perhaps one extra
static variable won't make much of a difference for when doing new code,
however I'm cautious of using static variables in newly written code as
it may set a precedent to use them even more which could be a pain for
eventual threading.

Alex Schultz



More information about the crossfire mailing list