From: Paul Brannan Date: 2002-10-25T01:54:10+09:00 Subject: Re: rb_gc_register_address problem On Wed, Oct 23, 2002 at 10:59:49PM +0900, William Djaja Tjokroaminata wrote: > Actually if there is concern that str is left allocated, I am wondering > why we have a vector of char* to begin with; isn't this mixing C++ with > C? Why don't you just have a C array of char* or a vector of > strings? For example, No, this is not mixing C++ with C; a char* is just as much C++ as it is C. The trick is knowing when to use them, and I think this case is justified. I can't use a C array of char*, because a C array is not easily resizable. 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 can easily pass a vector to foo() with: std::vector args; ... int argc = args.size(); foo(argc, &args[0]); The performance constraints the C++ standard puts on a vector almost 100% guarantees this to work portably. Paul