My ? is, can you rely on the (value, pointer to char *, or whatever ) when you return a local std::string?
For instance:
std::string f(std::string first, std::string last)
{
std::string name = first + last;
return name;
}
According to scoping rules, the memory occupied by the std::string variable "name" should be released back to the stack when the function exits. I see A LOT of code out there that does this very thing and the value returned is used later on. Are there special rules regarding std::string?
thank you!