I always try to avoid to return string literals, because I fear they aren\'t defined outside of the function. But I\'m not sure if this is the case. Let\'s take, for example
No, string literals do not have scope, so your code is guaranteed to work across all platforms and compilers. They are stored in your program's binary image, so you can always access them. However, trying to write to them (by casting away the const) will lead to undefined behavior.