Make string literals immutable in Windows

Jacob Carlborg doob at me.com
Sat Dec 1 12:26:46 UTC 2018


On 2018-11-30 10:24, bauss wrote:

> 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.

I know in the D1 days when a string literal was of the type "char[]". 
Then string literals were placed in a read only section in the binary on 
Posix, trying to modify a string literal caused a segfault (or similar). 
On Windows it worked fine to modify a string literal.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list