> > const char* > > string::c_str(void) { > > char buf[100]; > > > > strcpy (buf, this->internal_representation); > > return buf; > > } > > Isn't that undefined behavior, returning a pointer to a (non-static) > local variable? Right, I was trying to bring up an example and this one is not very good. Maybe something like that: const char* c_str() { vector<char> X(my_string); return &X[0]; }; char buf[]; strcpy(buf, c_str()); X destructor is called after strcpy is done. char buf[]; char *tmp=c_str(); strcpy(buf, tmp); X destructor is called before strcpy. At least this is how I understand it. -- Vlad