https://dlang.org/library/std/string/to_stringz.html
In my understanding it could not work:
toStringz
creates an array on the stack and returns its pointer. After toStringz
returns, the array on the stack is discarded and the pointer becomes invalid.
But I suppose it indeed works because of being a part of the standard library. So what is wrong in my understanding of the above?
Another related question:
What does scope return
in the signature of this function mean? I visited https://dlang.org/spec/function.html but found no scope return
there.