Runtime-mutating and passing around '[]const u8' character strings

Generally you are the one to decide where the string is stored. You can either store it in a buffer on the stack(be careful with lifetimes here!), or you need to allocate the string using some allocator(don’t forget to free it afterwards!).

Judging by the behavior you are getting I would guess that you are triggering some form of undefined behavior. One possible problem might be Pointers to Temporary Memory.

3 Likes