From: Paul Brannan Date: 2002-10-22T23:01:17+09:00 Subject: Re: rb_gc_register_address problem On Tue, Oct 22, 2002 at 07:15:13AM +0900, William Djaja Tjokroaminata wrote: > Hi Paul, > > I was puzzled by the example itself; hopefully it is really just an > example: > > 1) Why do you have a vector of char* instead of std::vector in > C++? In this case you don't get the advantage of the string copy > constructor when you call the push_back() on the vector, which then > requires you to store the corresponding VALUE. I'm storing command-line arguments for later use, to pass to a function that expects an array of char*. > 2) Why do you want store the char* of the VALUE instead of the VALUE > itself? You can then store the VALUE in a global ruby array instead of a > global vector so that you don't need rb_global_variable(&argv[0]). See above. > 3) By its name, rb_global_variable() is supposed to store a C global > variable (of type VALUE); so when we call rb_global_variable() for a > temporary C variable, at that point the C code design is questionable. Agreed. But if the GC stores a VALUE* instead of a VALUE, this is an extra (and seemingly unnecessary) indirection. I was curious if there was a reason for it, other than to prevent me from doing what I did. Paul