The BString is destroyed when the function returns and takes the storage pointed to by BString::String() with it, so returning such a pointer is bogus. Instead the return type is now a BString which takes over ownership of the string.
The BString is destroyed when the function returns and takes the storage pointed to by BString::String() with it, so returning such a pointer is bogus. Instead the return type is now a BString which takes over ownership of the string.