From: ahoward Date: 2002-10-23T06:17:48+09:00 Subject: Re: rb_gc_register_address problem On Tue, 22 Oct 2002, William Djaja Tjokroaminata wrote: > I am sorry that 53833 has been replied by 53842 and I don't think 53834 is > correct. It seems that rb_gc_mark() does not deal with VALUE* at all, but > only with VALUE. > > In other words, VALUE itself is a pointer (except for the immediate > object) and all the bit marking and other necessary processes are done on > the object/data pointed by VALUE. The VALUE itself may even be changed > within rb_gc_mark(), but the gc does not actually need &VALUE. my feeling is that, given a prototype like void method (const char const *ptr); you can be certain the method will change neither the thing pointed at, nor the ptr itself. given a prototype like void method (VALUE *ptr); you cannot be sure that, in a current or future release, the ptr itself will not be changed, since the compiler would allow this behavior. therefore it would be a bad idea to rely on the ptr not being changed. also, i agree that this was probably a design descision by matz; but since he did NOT write the prototype as void method (const VALUE const ptr); we may not assume ptr will never be changed. even if examination of the source reveals this to be true. -a -- ==================================== | Ara Howard | NOAA Forecast Systems Laboratory | Information and Technology Services | Data Systems Group | R/FST 325 Broadway | Boulder, CO 80305-3328 | Email: ahoward@fsl.noaa.gov | Phone: 303-497-7238 | Fax: 303-497-7259 ====================================