Hacker News new | ask | show | jobs
by deschutes 1520 days ago
String literals are specified to have static storage duration. That means references are valid at least until main returns. In practice string literals are immortal and references to them are always valid.
1 comments

I didn’t say string literal. I said “locally created string” i.e. std::string

In particular, my comment was referring to “return std::to_string(number);”

I missed that. You're right.