immutable string literal?

strtr strtr at spam.com
Mon Feb 22 08:24:36 PST 2010


Steven Schveighoffer Wrote:

> 
> But still, what does it matter?  Just don't use D1 if you want a compiler  
> error, or don't try and trick the system into modifying ROM!  There are  
> plenty of projects using D1 that just don't do this, and they are fine.   
> Implementing features to help people determine they created undefined  
> behavior is simply a waste of time.  If you feel you can fix it, by all  
> means submit a patch, and it might get in.
> 
> -Steve

The point is that I didn't know the char array literal to be immutable. I thought it would be like any other array literal. Now I get to recheck my whole project to see whether I ever change an immutable array. "Use D2"  is not really an argument in this case as I didn't even know I was using a "trick". For me it would have been great if the compiler would have segfaulted on this undefined behaviour.


More information about the Digitalmars-d-learn mailing list