Ok, here's a simple question.
I really like the convenience of being able to use strings as "pseudo-primitive types" in high-level languages. For instance, in Java you can write
String bob = "hello " + myObject.toString() + "!";
and it's as simple as that; garbage collection will be performed on the String that myObject.toString() returns, so no memory ends up getting lost. But in C++, the string that is returned by a toString() sort of method would return a String that needs to be deallocated by the use of a free() or delete operator (to free the dynamically-created character array in the String). Thus the above command in C++ (if we made a String class and overloaded the proper operators, etc.) would result in memory loss, since myObject.toString() would return a string that never gets deallocated.
The only thing I can think of to fix this is garbage collection, which wouldn't be very hard to implement, but it would require that the programmer run the garbage collection function occasionally, to free Strings that have a reference count of zero (such as the String made by myObject.toString() in the above example). But I don't know if this is the best way to do things.
What do you use when you need to do work with strings? Just plain old character arrays, like in C, or do you make your own String wrapper, or something else?