Yeah, it simplifies later code, and is safer in the face of future changes.
Or put another way, it tightens the API/contract of that chunk of code to always return a valid string.
That makes sense, with that "guard" at the top, the rest of the function can return the pointer anywhere. And I imagine the compiler will ensure the empty string literal is created only once. Good to know!
That makes sense, with that "guard" at the top, the rest of the function can return the pointer anywhere. And I imagine the compiler will ensure the empty string literal is created only once. Good to know!