From: nobu.nokada@... Date: 2002-08-06T03:08:13+09:00 Subject: Re: What Is the Rule to Declare Global Variables? Hi, At Tue, 6 Aug 2002 00:39:10 +0900, William Djaja Tjokroaminata wrote: > Thanks for the assertion. After reading the code again, it is the same > old problem: some of the global variables have not been taken care of by > either "rb_global_variable", "rb_define_readonly_variable", or > "rb_define_variable". > > The only tricky part is, the code has been working for so long, and only > much later that the problem appears. Now I am wondering, what is the rule > to protect the global variables? Do ALL C VALUE global variables have to > be protected as above? Or, ALL, except: > > - variables that have been used in "rb_define_module..." > - variables that have been used in "rb_define_class..." > - (others?) All of your list protect the variables. Particularly, all what rb_global_variable() does is it. And other Ruby global variables and classes/modules are also protected of course. > On the other hand, if we protect such variables, will it result in > segmentation fault instead? Or is it OK to "overprotect" them? (Is it > similar to the C's problem of is it OK to free a variable that has been > freed?) Only speed and space penalties. -- Nobu Nakada