On Monday, 13 December 2021 at 12:06:53 UTC, WebFreak001 wrote:
You should really use `.dup` if you want to mutate your string.
(You would need to duplicate anyway if you don't want an unsafe
cast)
(this produces an unpredictable result??)
char* w = cast(char*)str.dup;
(but this seems to work - as expected)
char* w = strdup(cast(char*)str); // import core.stdc.string :
strdup;
pro-tip for bugs like this: just slap `@safe:` at the start of
every file, the compiler will tell you everything that is risky
I like this idea. Thanks ;-)