Make string literals immutable in Windows

bauss jj_1337 at live.dk
Fri Nov 30 09:24:24 UTC 2018


On Thursday, 29 November 2018 at 23:56:27 UTC, Andrew Pennebaker 
wrote:
> I was surprised to read from the FreeBSD documentation that D 
> string literals are actually writeable in Windows:
>
> https://dlang.org/dmd-freebsd.html
>
> Can we fix that? I think C literals were already immutable, 
> though I'm not sure about the particulars of the Visual Studio 
> C/C++ semantics.

They're not writable in the sense you think so it doesn't really 
matter.

Strings are still constructed as immutable(char)[] on Windows. 
It's the same across all platforms.

I guess the difference is that you can cast immutable away and 
that's UB and thus it doesn't really matter.


More information about the Digitalmars-d mailing list