hello, say I have a function that returns a string created with
fmt::bsprintf:
fn stackstr() str = {
let b: [128]u8 = [0...];
return fmt::bsprintf(&b, "{} {}!", "hello", "world");
};
the question is: Is this fundamentally incorrect because functions
shouldn't return stack allocated strings? As I understand it string are
like pointers so the caller does not copy the string.
Thank you
On Tue May 30, 2023 at 7:16 AM UTC, bruma wrote:
> the question is: Is this fundamentally incorrect because functions
> shouldn't return stack allocated strings? As I understand it string are
> like pointers so the caller does not copy the string.
yes, that's correct