From: William Djaja Tjokroaminata Date: 2002-10-25T06:23:41+09:00 Subject: Re: rb_gc_register_address problem Hi Paul, Paul Brannan wrote: > I can't use a vector of strings (*), because I need to pass this data to > function that someone else wrote with a signature that looks like: > void foo(int & argc, char ** argv); I guess then it is that person who mixes C++ with C. It is not even void foo (int argc, ...) nor void foo (const int & argc, ...) So the signature may indicate that he intends to modify argc, in contrary to common C functions of similar type (such as also shown in Ruby source codes). > I can easily pass a vector to foo() with: > std::vector args; > ... > int argc = args.size(); > foo(argc, &args[0]); This whole function argument passing is rather frightening because, first as pointed above, the person may modify argc, and second, then he may also modify argv, in which case then the original vector may be broken. Unless I can read the whole content of foo, I personally will not be comfortable of using foo using this scheme. > The performance constraints the C++ standard puts on a vector almost > 100% guarantees this to work portably. Because of the O(1) requirement, do you know of any instance where the vector is implemented differently (using a deque, perhaps)? I do not know too many STL libraries. Regards, Bill