is this code ok?
void SomeClass :: foo(const char * _name) { //name is of type const char * name = std::string(_name).c_str(); }
It's not okay to use it afterwards - the memory can be freed as soon as the temporary goes. Why don't you use a string as a member? Then you wouldn't have to worry about memory management.